SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 where in two conditions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pavlos
Yak Posting Veteran

Greece
58 Posts

Posted - 07/30/2012 :  20:35:03  Show Profile  Reply with Quote
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

Greece
58 Posts

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

sorry
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000