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
 Development Tools
 Other Development Tools
 Query

Author  Topic 

TheShadow
Starting Member

2 Posts

Posted - 2005-05-26 : 00:04:06
I'm having trouble thinking how to write a query ... i have two tables customer and contact ...they share a common element of customerID ... their is a login form based on the contactID, contactPassword within the contact table, based on that i want the contactID and customerID of contact, to display the fields of the customer table ...

Anyone keep up with that?

raclede
Posting Yak Master

180 Posts

Posted - 2005-05-26 : 00:54:47
SELECT *
FROM Customer
RIGHT JOIN Contact
ON Customer.CustomerID = Contact.CustomerID


raclede
Go to Top of Page

raclede
Posting Yak Master

180 Posts

Posted - 2005-05-26 : 00:57:20
quote:
Originally posted by TheShadow

I'm having trouble thinking how to write a query ... i have two tables customer and contact ...they share a common element of customerID ... their is a login form based on the contactID, contactPassword within the contact table, based on that i want the contactID and customerID of contact, to display the fields of the customer table ...

Anyone keep up with that?



No need for contactID to display the fields in customer table since you have said the only common element they have is CustomerID

raclede
Go to Top of Page

TheShadow
Starting Member

2 Posts

Posted - 2005-05-26 : 01:01:37
quote:
Originally posted by raclede

quote:
Originally posted by TheShadow

I'm having trouble thinking how to write a query ... i have two tables customer and contact ...they share a common element of customerID ... their is a login form based on the contactID, contactPassword within the contact table, based on that i want the contactID and customerID of contact, to display the fields of the customer table ...

Anyone keep up with that?



No need for contactID to display the fields in customer table since you have said the only common element they have is CustomerID

raclede



Sorry,

I'm having trouble working this out ...

each contact has a customerID ... based on this contact's customerID, we want to show the company details of those with that same customerID ...

is that what, that does?
Go to Top of Page
   

- Advertisement -