Finding SQL Users who satisfy two different conditions -


i have table following:

user id    ||    quality_a  200;              1  15;               3  35;               7  76;               6  200;              5 

if want find users such exists row users quality 1, , exists row users quality 5, how do so. instance, in table above, user 200 has 2 rows, , qualities respectively 1 , 5. counted.

also, should titled appreciated.

you can try this

select user_id table1 quality_a in (1,5) group user_id having count(distinct quality_a) >= 2 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -