我在mysql查询中做错了。谁能帮我吗??
select * from user_errors where user_id = '2'
IF( type = 'custom_type' ) second_user_id != '2' ELSE second_user_id = '2'
END IF
无需使用if else
,无论如何都可以尝试一下;)
select * from user_errors
where user_id = '2'
and ((type = 'custom_type' and second_user_id != '2') or second_user_id = '2')
否则,您必须使用它,尝试一下;)
select * from user_errors
where user_id = '2'
and case when type = 'custom_type' then second_user_id != '2' else second_user_id = '2' end
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句