我有以下疑问:
SELECT b.id, b.created_at, b.updated_at, b.reservation_code, b.reservation_type, b.reservation_date,
b.reservation_time, b.party_size, b.customer_code, b.deposit_total,
b.payment_code, b.voucher_code, b.reservation_processed, b.payment_status,
b.receipt_mailed, b.reservation_status, b.special_requirements, b.email_csv, b.occasion_type, p.name, p.slug
FROM bookings b
JOIN premises p ON p.code = b.premises_code WHERE b.premises_code = ? AND b.reservation_processed != 'no-show' OR b.reservation_processed != 'removed'
我要返回除“no show”或“removed”之外的任何保留的行
现在它仍然返回“删除”的行
我直接在sql中运行了命令,遇到了同样的问题:(
1条答案
按热度按时间kiayqfof1#
使用
NOT IN
:你似乎不熟悉布尔逻辑的规则。您的逻辑被解释为:
但你真的打算: