sql 多个字段排序问题
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;