根据查询结果值显示结果


SELECT
CURDATE() AS '时间'
(CASE
WHEN Days=0 THEN '0'
WHEN 1<=Days AND Days<=15 THEN '1-15'
WHEN 16<=Days AND Days<=30 THEN '16-30'
WHEN 31<=Days AND Days<=60 THEN '31-60'
WHEN 61<=Days AND Days<=90 THEN '61-90'
WHEN 91<=Days AND Days<=120 THEN '91-120'
WHEN 121<=Days AND Days<=150 THEN '121-150'
WHEN 151<=Days AND Days<=180 THEN '151-180'
WHEN 181<=Days AND Days<=360 THEN '181-360'
WHEN Days>360 THEN '360+'
ELSE NULL
END)
AS 'DAYS_CLUSTER'

 

SELECT 
CURDATE() AS '日期',
(CASE tableA.gender
WHEN '0' THEN ''
WHEN '1' THEN ''
ELSE DATE_SUB(CURDATE(),INTERVAL 1 DAY)
END
) AS '性别,
FROM tableA

 

posted @ 2019-11-05 14:40  stuka  阅读(208)  评论(0编辑  收藏  举报