SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 inner join
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

anhamade
Starting Member

7 Posts

Posted - 03/01/2014 :  02:34:22  Show Profile  Reply with Quote
how can i make the from part inner join. this is a link for the tables
http://northwinddatabase.codeplex.com/

USE northwind
select Employees.FirstName,Employees.LastName,
Territories.TerritoryDescription,
[Order Details].UnitPrice,[Order Details].Quantity,
Products.ProductName,
Region.RegionDescription,
Suppliers.CompanyName as 'Supplying Company',
Customers.CompanyName as 'Purchasing Company',
Shippers.CompanyName as 'Shipping Company'

from Employees, Territories, [Order Details],Products,Region,
Suppliers,Customers,Shippers,



where ([Order Details].Quantity >= 50) and (Territories.TerritoryDescription like '%Boston%' or Territories.TerritoryDescription like '%Cambridge%')
and Region.RegionDescription like '%Eastern%' and [Order Details].UnitPrice >= 8.00 and Products.ProductName like 'Jack''s New England Clam Chowder'

khtan
In (Som, Ni, Yak)

Singapore
17584 Posts

Posted - 03/01/2014 :  02:51:41  Show Profile  Reply with Quote
duplicates of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=192585

Please do not cross post and continue on that thread. I have posted a snippet of the codes using INNER JOIN. If you are not familiar with INNER JOIN, i suggest you refer back your coursework or read up more on it

example :
http://www.w3schools.com/sql/sql_join_inner.asp




KH
Time is always against us

Go to Top of Page

anhamade
Starting Member

7 Posts

Posted - 03/01/2014 :  03:21:08  Show Profile  Reply with Quote
i still have problem with the shipper table to which table do i join it too

quote:
Originally posted by khtan

duplicates of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=192585

Please do not cross post and continue on that thread. I have posted a snippet of the codes using INNER JOIN. If you are not familiar with INNER JOIN, i suggest you refer back your coursework or read up more on it

example :
http://www.w3schools.com/sql/sql_join_inner.asp




KH
Time is always against us



Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17584 Posts

Posted - 03/01/2014 :  03:23:23  Show Profile  Reply with Quote
look at the database diagram, the shippers is relate to which other table ?

And also take a look at the section of the codes that i have posted in your other thread. I have added a table in the FROM which is does not exists in your original query


KH
Time is always against us


Edited by - khtan on 03/01/2014 03:25:01
Go to Top of Page

anhamade
Starting Member

7 Posts

Posted - 03/01/2014 :  03:37:21  Show Profile  Reply with Quote
this is the code i have right now and when i run it i get no errors but at the same time nothing pops up. i


USE northwind
select Employees.FirstName,Employees.LastName,
Territories.TerritoryDescription,
[Order Details].UnitPrice,[Order Details].Quantity,
Products.ProductName,
Region.RegionDescription,
Suppliers.CompanyName as 'Supplying Company',
Customers.CompanyName as 'Purchasing Company',
Shippers.CompanyName as 'Shipping Company'

FROM [Orders]
INNER JOIN [Order Details] ON [Orders].OrderID = [Order Details].OrderID
INNER JOIN [Customers] ON [Orders].CustomerID = [Customers].CustomerID
INNER JOIN [Employees] ON [Orders].EmployeeID = [Employees].EmployeeID
INNER JOIN [Shippers] on [orders].OrderID = [Shippers].ShipperID,
Territories inner join Region
on Territories.RegionID = Region.RegionID,
Products inner join Suppliers
on Products.SupplierID = Suppliers.SupplierID

where ([Order Details].Quantity >= 50) and (Territories.TerritoryDescription like '%Boston%' or Territories.TerritoryDescription like '%Cambridge%')
and Region.RegionDescription like '%Eastern%' and [Order Details].UnitPrice >= 8.00 and Products.ProductName like 'Jack''s New England Clam Chowder'






quote:
Originally posted by khtan

look at the database diagram, the shippers is relate to which other table ?

And also take a look at the section of the codes that i have posted in your other thread. I have added a table in the FROM which is does not exists in your original query


KH
Time is always against us



Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17584 Posts

Posted - 03/01/2014 :  03:46:01  Show Profile  Reply with Quote
1. you should change your to all use JOIN method and not partial
2. check the INNER JOIN .. ON part. make sure you are joining on the correct column. Example, this is obviously wrong
INNER JOIN [Shippers] on [orders].OrderID = [Shippers].ShipperID


also, you might want to download the "A4 Size ready to print detail version" from the codeplex site. It gives you more detail information on how the Orders table is related to the Shippers table


KH
Time is always against us


Edited by - khtan on 03/01/2014 03:50:42
Go to Top of Page

anhamade
Starting Member

7 Posts

Posted - 03/01/2014 :  04:10:31  Show Profile  Reply with Quote
kk i got it. its shipvia and i got more then 418 rows. but whats confusing me is the question which says i need to paste both rows from the results tab, with all properly named headings. does this mean
that am only recieving two rows from the whole query or he is just saying just copy the first two rows.




quote:
Originally posted by khtan

1. you should change your to all use JOIN method and not partial
2. check the INNER JOIN .. ON part. make sure you are joining on the correct column. Example, this is obviously wrong
INNER JOIN [Shippers] on [orders].OrderID = [Shippers].ShipperID


also, you might want to download the "A4 Size ready to print detail version" from the codeplex site. It gives you more detail information on how the Orders table is related to the Shippers table


KH
Time is always against us



Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17584 Posts

Posted - 03/01/2014 :  04:16:44  Show Profile  Reply with Quote
it probably mean you need to paste the entire result plus the column heading


KH
Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000