| 
	
 | 
 Posted by Tom Moreau on 03/21/06 15:03 
That's different.  You're looking at what's called Relational Division: 
 
select 
    UserID 
from 
    ENC_UserDefinedData 
where 
( 
[ENC_UserDefinedData].[UserDefinedField] = 8 
AND 
[ENC_UserDefinedData].[Value] LIKE '%Picasso%' 
) 
OR 
( 
[ENC_UserDefinedData].[UserDefinedField] = 9 
AND 
[ENC_UserDefinedData].[Value] = '48' 
) 
group by 
    UserID 
having 
    count (*)    >= 2 
 
--  
   Tom 
 
---------------------------------------------------- 
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA 
SQL Server MVP 
Columnist, SQL Server Professional 
Toronto, ON   Canada 
www.pinpub.com 
.. 
"Jose" <discussions@avandis.co.uk> wrote in message  
news:1142932229.880694.305600@v46g2000cwv.googlegroups.com... 
Thanks for your reply Tom. 
 
I would like that all conditions are met - let me explain. In words I 
would like "get me the users who answered "apple" for questions 5 AND 
answered "red" for question 3". Each row in my table contains an answer 
to a question. 
 
Do you have any more suggestions? 
 
Kind regards, 
Jose
 
  
Navigation:
[Reply to this message] 
 |