Forum Moderators: open
Have one table (table2) with user options. Example:
userid ¦ option_name ¦ option_value
1 notifyme 1
2 lastname smith
3 notifyme 0
After a certain action in the code, I need to take all the user ids and place them in another table if an only if "notifyme" is 1 (true).
Basically, this is what I tried:
insert into table1
set user_id = (select userid from table2
where option_value = 1
and option_name = 'notifyme'), item_id = 4
I keep getting this error: "subquery returns more than one row"
What am I doing wrong?
insert into table1
set user_id = (select DISTINCT userid from table2
where option_value = 1
and option_name = 'notifyme'), item_id = 4