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
 Inner join HELP!

Author  Topic 

Crima
Starting Member

17 Posts

Posted - 2012-10-18 : 16:09:46
I've been trying to figure out this problem

Write a SELECT statement that returns all columns from the Vendors table inner-joined with the
Invoices table.

so far i've gotten

SELECT * FROM Vendors
INNER JOIN Invoices
ON Vendor.VendorID = Invoice.VendorID


but it's not liking Vendor.VendorID = Invoice.VendorID
I don't know another way since this is the only way they're related.

Any help helps!

A witty student

mandm
Posting Yak Master

120 Posts

Posted - 2012-10-18 : 16:19:53
If your table names are Vendors and Invoices then your table references need to match in the ON condition. i.e. Invoices.VendorID = Vendors.VendorID
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-18 : 16:20:20
what do you mean its not liking Vendor.VendorID = Invoice.VendorID?

can you elaborate with some sample data?


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Crima
Starting Member

17 Posts

Posted - 2012-10-18 : 17:01:29
I just figured it out. Supposed to be "Vendors" instead of Vendor, same with Invoices

-________________- Always a little mistake that drives me nutts.

A witty student
Go to Top of Page
   

- Advertisement -