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
 General SQL Server Forums
 New to SQL Server Programming
 where in two conditions

Author  Topic 

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-07-30 : 20:35:03
Hey Guys,

I have a results table that returns warehouse codes and item codes.
eg
WH IC
1, A1
1, A3
2, A3
2, A6
2, A7
3, B6
4, B6
5, B7
6, A3
6, A1

all items exist in all warehouses but I only want to return the rows where an item exists in the warehouse from the above query.

I was thinking
something like this:
where itemcode and warehouse IN (select query)

but that doesn't work.

If i go where item code in (select query)
and
warehouse in (select query)

it will return way too many rows.

hope this makes sense.

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-07-30 : 21:12:28
ignore guys,
i did this with a left join and removed nulls.

sorry
Go to Top of Page
   

- Advertisement -