有没有办法改变这个查询,以便检查frp_fundraisingprogram.start_date是否为空或包含默认值?
SELECT frp_fundraisingprogram.id AS id
FROM frp_fundraisingprogram
WHERE frp_fundraisingprogram.start_date <= DATE_ADD(UTC_TIMESTAMP(), INTERVAL - 2 day)
AND frp_fundraisingprogram.date_entered > '2015-04-09 16:55:18'
AND NOT EXISTS
(SELECT * FROM aow_processed
WHERE aow_processed.aow_workflow_id='9bc1bb2e-cd5a-5c75-cc68-5526ae30331e'
AND aow_processed.parent_id=frp_fundraisingprogram.id
AND aow_processed.status = 'Complete' AND aow_processed.deleted = 0)
AND frp_fundraisingprogram.deleted = 0
答案 0 :(得分:0)
只需在你的where子句中加入......
`...WHERE not isnull(frp_fundraisingprogram.start_date)
AND frp_fundraisingprogram.start_date != '0000-00-00 ...`
如果您要尝试排除这些记录。如果您只想显示这些记录,则可以反转逻辑。