I want to return 1 if a user_id have status=1 to any of these product_id 2,3,4 in one MySQL query else return 0
Table: user_status
status_id user_id product_id status
---------------------------------------------
1 27 2 1
2 27 3 0
3 27 4 1
4 32 2 1
5 35 4 1
6 40 2 0
7 40 3 1
8 41 2 0
9 41 3 1
10 45 4 0
I tried the following query,
SELECT status FROM `user_status` WHERE `user_id` = '27' AND status = '1' AND product_id IN (2,9,11);