ec_perform_sh_sailing_plan表,上数日期字段shangshuDate;预到日期yuji_daoda_date; 如果上数日期有值,按预到时间降序。如果上数日期没有值,按预到时间升序,上数日期没有值的排在有值的前面;
SELECT * FROM ec_perform_sh_sailing_plan ORDER by CASE WHEN shangshuDate IS NULL THEN 0 ELSE 1 END asc, CASE WHEN shangshuDate IS NOT NULL THEN yuji_daoda_date ELSE yuji_daoda_date END DESC;
标签:shangshuDate,多个,daoda,日期,sql,date,排序,yuji,预到 From: https://www.cnblogs.com/dengying/p/17812992.html