Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
anhamade
Starting Member
7 Posts |
Posted - 2014-03-01 : 02:34:22
|
how can i make the from part inner join. this is a link for the tableshttp://northwinddatabase.codeplex.com/USE northwindselect 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)
17689 Posts |
|
anhamade
Starting Member
7 Posts |
Posted - 2014-03-01 : 03:21:08
|
i still have problem with the shipper table to which table do i join it tooquote: Originally posted by khtan duplicates of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=192585Please 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 itexample :http://www.w3schools.com/sql/sql_join_inner.asp KH[spoiler]Time is always against us[/spoiler]
|
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-03-01 : 03:23:23
|
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[spoiler]Time is always against us[/spoiler] |
|
|
anhamade
Starting Member
7 Posts |
Posted - 2014-03-01 : 03:37:21
|
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. iUSE northwindselect 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[spoiler]Time is always against us[/spoiler]
|
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-03-01 : 03:46:01
|
1. you should change your to all use JOIN method and not partial2. check the INNER JOIN .. ON part. make sure you are joining on the correct column. Example, this is obviously wrongINNER 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[spoiler]Time is always against us[/spoiler] |
|
|
anhamade
Starting Member
7 Posts |
Posted - 2014-03-01 : 04:10:31
|
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 meanthat 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 partial2. check the INNER JOIN .. ON part. make sure you are joining on the correct column. Example, this is obviously wrongINNER 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[spoiler]Time is always against us[/spoiler]
|
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-03-01 : 04:16:44
|
it probably mean you need to paste the entire result plus the column heading KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|
|
|