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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help with join query

Author  Topic 

nacnac
Starting Member

2 Posts

Posted - 2008-08-21 : 06:52:40
This is simplified but basically the situation

I have 3 tables;

customer
cust_id
cust_name

products
prod_id
prod_price

custom_price
cust_id
prod_id
custom_prod_price

Customers may or may not have custom prices in the custom_prices table.

What I would like is a query listing all the products in the products table and if they are available the custom prices joined to the products for an individual customer.

thanks for any help out there!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-21 : 07:03:03
[code]select *
from products p
left join custom_price cp
on cp.prod_id=p.prod_id
left join customer c
on c.cust_id=cp.cust_id[/code]
replace * with your actual columns.
Go to Top of Page

nacnac
Starting Member

2 Posts

Posted - 2008-08-21 : 09:16:47
thanks a lot!
Go to Top of Page
   

- Advertisement -