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.
| Author |
Topic |
|
hotshot_21
Yak Posting Veteran
97 Posts |
Posted - 2006-03-07 : 02:25:18
|
| i have 2 tables items and purchase_details. Items table contain :- item_id, name, descpurchase table contain :- pid, item_id, pricei want list of item name which is not there in purchase tableeg.item table is as followitem_id name desc1 test nkj2 test1 kjjk3 t jhvj 4 test3 kgjhg5 ggvg hbhjand purchase table containpid item_id price1 3 402 4 503 4 50i want output as item_id125 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-07 : 02:30:40
|
| [code]select i.item_idfrom items iwhere not exists (select * from purchase_details p where p.item_id = i.item_id)orselect i.item_idfrom items i left join purchase_details p on i.item_id = p.item_idwhere p.item_id is null[/code]----------------------------------'KH' |
 |
|
|
|
|
|