mysql - How to check input value in a SQL query using CASE-WHEN -
i want create query insert data, 1 of field's data selected table based on value of input field.
i got fields : receiver,receiver_type etc. receiver value id 1 of 2 tables users or admins.
i created query like:
insert nots (receiver,receiver_type,...) values ( case @receiver_type when 1 (select id admins username=@param) when 2 (select id users username=@param) end , 1, ...)
does sql offer input value checking, , if yes how write query?
Comments
Post a Comment