mysql - Condense 3 SELECTS down to one table -
the 3 statement (a little contrived simplicity) are:
select `user_id` `movie_id` = 1 select `user_id` `movie_id` = 2 select `user_id` `movie_id` = 3
what twofold:
- join 3 of above single table of id's match 3 of movie_id
- make of 1 query reduce mysql reads speed performance
i sure there simple way it, not strongest sql user, of help!
select count(distinct movie_id), user_id table move_id in (1,2,3) group user_id having count(distinct movie_id) = 3
what obtain distinct count of movies per user_id. limits results users having count of 3.
Comments
Post a Comment