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
 Joining Tables

Author  Topic 

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2011-02-08 : 16:16:02
Hi -

I am attempting to join tables on multiple items. Is this possible to do without creating a new field for joining purposes?

For Example, I would like all records from my billing table when there is a match to my member table of the following criteria: billing.date = member.date AND billing.rate_code = member.rate_code AND billing.policy_number = member.policy_number......

Can anyone please help??

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-02-08 : 16:21:40
Yes, exactly as you wrote:

SELECT * FROM billing INNER JOIN member ON billing.date = member.date AND billing.rate_code = member.rate_code AND billing.policy_number = member.policy_number
Go to Top of Page

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2011-02-08 : 16:25:54
Thank you, I didn't know you could use AND's like that and my tables are too big to test it out on......
quote:
Originally posted by robvolk

Yes, exactly as you wrote:

SELECT * FROM billing INNER JOIN member ON billing.date = member.date AND billing.rate_code = member.rate_code AND billing.policy_number = member.policy_number

Go to Top of Page
   

- Advertisement -