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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need help

Author  Topic 

Jouni79
Starting Member

9 Posts

Posted - 2009-09-19 : 13:24:08
Hello everybody,

I am just learning basic SQL. I am little bit confused.What is wrong in my sql query:
SELECT dbo.OrderHeader.ReferenceNumber
FROM dbo.OrderHeader
INNER JOIN
dbo.OrderLine ON dbo.OrderHeader.OrderHeaderID=dbo.OrderLine.OrderHeaderID INNER JOIN
dbo.Supplier ON dbo.OrderHeader.SupplierID = dbo.Supplier.SupplierID.


OrderHeader contains delivery address and delivering adress and so on
OrderLine Contains information what is actually ordered. Every order can contains multiple Items
Supplier contains information what is ordered and from who

I know that I have 4 row of data in Orderheader table , and every order have 2 different item in table.
now when i run query it gives me 7 rows, and it should give me just 4.Can someone tell what I am doing wrong



webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-20 : 11:27:56
Without seeing the data it is not even simple to see what is going on.
If you can show the table structure and sample of the data it would be possible to help because your query looks fine.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -