sql - mySQL - manually add an ID to a "WHERE column_id IN" (subquery...) -
this strange query have not had write before have situation need manually add 1 variable "where in" statement. example better explain problem.
select * user id in (select user_id order sub_total > 150)
in specific situation, need manually add 1 more user_id "in" statement's sub-query regardless if have order subtotal grater 150.
i have tried doing following, , thought work returns weird results , not work...
select * user id in (select user_id order sub_total > 150) or id = 1234
basically, want sub-query return user id's match condition , include 1 specify myself. best way accomplish this? i've tried looking have not found fulfill requirement.
use or operator:
select * user id in (select user_id order sub_total > 150) or id = 123 or id in (345,567)
basically in operator x in (1,2,3)
shortcut for:
x = 1 or x = 2 or x = 3
Comments
Post a Comment