May I ask that I have to perform checking on the userId column but the input may be more than 1.
I have to check whether the userId(input(s)) is one of the record inside the table or not.
IF all of them inside the table
SQL return 1
IF one of them is NOT
SQL return 0
I'm a newbie and what I can do is only
SELECT count(1) from users_roles where userid = ?
I think you want something like this:
select case when count(*) = 3 then 1 else 0 end) as all_there from users_roles where userid in (?, ?, ?);
3 is equal to the number of parameters in the