sql max函数和case when的结合使用

SELECT MAX(CASE WHEN atd IS NULL THEN ata ELSE atd END) AS max_time
FROM table t
WHERE snum = 740 AND (status = 0 OR status = 1)

你可能感兴趣的:(sql,数据库)