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 2000 Forums
 SQL Server Development (2000)
 want a query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-06 : 10:08:44
kalpak writes "i have two table one is table1 which contains
itemid,desc,vnname,qty
second table table2 contains
itemid,qty

now i want fetch all columns from table1 and qty from table2 but the condition is :

i want that rows which have the same itemid in both tables and that rows which itemid doen't exist in table2.

Thanks

kalpak"

Nazim
A custom title

1408 Posts

Posted - 2001-12-06 : 10:16:53
select t1.itemid,t1.desc,t1.desc,t1.vnname,t2.qty from table1 t1
left join table2 t2
on t1.itemid=t2.itemid

this should do it, i would suggest u to read about joins.




-------------------------
Nazim -- "Success is when Preparedness meets Opportunity"
Go to Top of Page
   

- Advertisement -