Click here to Skip to main content
15,559,455 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,

SQL
select * from userInterest
where (userInterest.interest = 'abc' AND userInterest.interest = 'def')


I am trying to query a table to find out the users with 'abc' and 'def' interest and interest is SET type. The above query isn't working. What is the way to find out SET types value??

Thanks
Posted
Updated 10-Apr-13 4:45am
v2

1 solution

Try this:
SQL
select * from userInterest
where (userInterest.interest LIKE '%abc%' OR userInterest.interest LIKE '%def%')
 
Share this answer
 
v5
Comments
AndyInUK 10-Apr-13 9:51am    
I have tried this, but the problem is it list the users with interest 'abc' or 'def' but there are many users with interest as both 'abc' AND 'def'. So I want to list those users too. I am expecting the result for interest should be
Interest
abc,def
Leo Chapiro 10-Apr-13 9:55am    
Oh, I understand: in this case you need a LIKE operator!
AndyInUK 10-Apr-13 10:16am    
Yap, that works, thanks. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900