私は自分のmysqlクエリで間違いを犯しています。誰も私を助けることができますか?WHERE句でmysqlクエリのelse文を取得する方法は?
select * from user_errors where user_id = '2'
IF(type = 'custom_type') second_user_id != '2' ELSE second_user_id = '2'
END IF
私は自分のmysqlクエリで間違いを犯しています。誰も私を助けることができますか?WHERE句でmysqlクエリのelse文を取得する方法は?
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
を使用するには、no必要はとにかくこれを試して、ありません。)
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
このような用途(あなたドン他の条件の場合に使用する必要があります)
select * from user_errors where user_id = '2'
and ((type = 'custom_type' and second_user_id != '2')
or (type != 'custom_type' and 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)
は、エラーメッセージ –