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 |
|
vishalj
Starting Member
32 Posts |
Posted - 2006-06-14 : 14:12:00
|
| i have a table withsale_id , sale_object_idfor each sale_id there can be multiple sale_object_id's but not 2 same sale_object_id in each salesale_id sale_object_id1 1001 1201 1402 1002 1203 1003 1404 1404 1005 1006 1206 100 now I want to write a query to find out sale_id where sale_object_id was say not = 100. If I do select * from sales where sale_object_id <>100 i still get 1 and 2 in the result.But I want to eliminate 1 & 2 and all other id's which even have 100 in them. |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-06-14 : 15:06:23
|
| [code]select a.*from sales awhere a.sale_id not in ( select b.sale_id from sales b where b.sale_object_id = 100 ) [/code]CODO ERGO SUM |
 |
|
|
|
|
|