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
 Join tables on date and qty

Author  Topic 

Matt23
Starting Member

5 Posts

Posted - 2010-07-21 : 14:34:52
I want to join 2 tables together but they have no distinct column that is the same between them. I am very new to SQL query's and I was wondering what the syntax is to join two tables where the date and the qty are both the same.

So if I have table A and table B, would the statement be select * from A inner join B on a.date=b.date and a.qty=b.qty? This is not working when I run it. Any help would be great thanks.

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-07-21 : 14:49:45
if you don't have any same values to join to tables, you should consider joining those to table any other way or changing the design of the table.

can you describe your model a bit into details and give some sample data and what would be desired output.
Go to Top of Page
   

- Advertisement -