By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,766 Members | 1,295 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,766 IT Pros & Developers. It's quick & easy.

WHERE colum1 = (SELECT with multiple results)

P: 1
Hi I have a problem with a WHERE clause, I have to compare a column value to a query that returns multiple results, I also tried to substitute the "=" for "IN" but didn't worked.
Any help would be apreciated: D
Oct 10 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,134
You could try something like this
Expand|Select|Wrap|Line Numbers
  1. SELECT field list
  2. FROM YourTable
  3. join (   SELECT TheMultipleResultField 
  4.           FROM TheRecordSource
  5.           WHERE YourFilterRequirements
  6. ) a on column1=TheMultipleResultField
here, the join will filter out the rows that don't have matching
records in the subquery.
Oct 11 '08 #2

Expert 2.5K+
P: 2,878
Be careful with IN, it does not work well with NULL values.

I got some notes about that here

-- CK
Oct 12 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.