0
我想篩選使用WHERE條件返回的行。問題是MySQL不允許我在WHERE子句中使用自定義列名。它給出了語法錯誤。基於自定義計算字段篩選行
SELECT jobs.*,
CASE
WHEN job_status = 'submitted' THEN ((2 * 86400) - ($mktime - job_timestamp))/86400
WHEN job_status = 'agreement_pending' THEN ((1 * 86400) - ($mktime - job_tstamp_agpending))/86400
WHEN job_status = 'payment_complete' THEN ((job_duration * 86400) - ($mktime - job_tstamp_pcomplete))/86400
ELSE 1000000
END AS sla
FROM jobs
WHERE sla < 0
是否有可能仍然過濾行了WHERE sla < 0
條件?