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
 Multiple Joins

Author  Topic 

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2009-01-19 : 19:12:35
I am working on a query that relies on data from multiple tables. This is what I have:

select tblBilling.cID, tblBilling.bID, tblBilling.bNumber, tblBilling.bAmount, tblPayments.pAmount, tblBilling.bStatus,
tblPayments.pID, tblCustomers.cFirstName, tblCustomer.cLastName

from tblBilling INNER JOIN
tblCustomer ON tblBilling.cID = tblCustomer.id
tblPayments INNER JOIN
tblBilling ON tblBilling.cID = tblPayments.cID


Can you help me?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-19 : 20:01:30
Help you with what? You haven't said what the issue is.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2009-01-19 : 20:44:23
A MULTIPLE TABLE JOIN
quote:
Originally posted by tkizer

Help you with what? You haven't said what the issue is.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog


Go to Top of Page

EugeneLim11
Posting Yak Master

167 Posts

Posted - 2009-01-19 : 21:11:52
Hi,

Is this what you are trying to do?

select tblBilling.cID, tblBilling.bID, tblBilling.bNumber, tblBilling.bAmount, tblPayments.pAmount, tblBilling.bStatus, tblPayments.pID, tblCustomers.cFirstName, tblCustomer.cLastName
from tblBilling, tblPayments, tblCustomer
where
tblBilling.cID = tblCustomer.id
and
tblBilling.cID = tblPayments.cID

The above should work for inner join


check out my blog at http://www.aquariumlore.blogspot.com
Go to Top of Page

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2009-01-19 : 21:17:11
That worked perfect! Thank you.

quote:
Originally posted by EugeneLim11

Hi,

Is this what you are trying to do?

select tblBilling.cID, tblBilling.bID, tblBilling.bNumber, tblBilling.bAmount, tblPayments.pAmount, tblBilling.bStatus, tblPayments.pID, tblCustomers.cFirstName, tblCustomer.cLastName
from tblBilling, tblPayments, tblCustomer
where
tblBilling.cID = tblCustomer.id
and
tblBilling.cID = tblPayments.cID

The above should work for inner join


check out my blog at http://www.aquariumlore.blogspot.com

Go to Top of Page
   

- Advertisement -