时间:2021-07-01 10:21:17 帮助过:43人阅读
SELECT user_id AS 姓名 ,
(CASE WHEN sex=0 THEN ‘女‘ ELSE ‘男‘ END) AS 性别,
mobileno AS 电话,
startdate AS 入职日期,
enddate AS 到职日期,
(CASE WHEN enddate>0 THEN
TIMESTAMPDIFF(YEAR,STR_TO_DATE(startdate,‘%Y-%m-%d %Y‘),enddate)
ELSE
TIMESTAMPDIFF(YEAR,STR_TO_DATE(startdate,‘%Y-%m-%d %Y‘),LOCALTIME()) END )AS 工龄,
curstar AS 星级,
curshopname AS 门店,
strength AS 优势 ,
weakness AS 劣势,
improve AS 进步点 ,
memo AS 备注,
(CASE WHEN enddate>0 THEN ‘离职‘ ELSE ‘在职‘ END ) AS 状态
FROM ft_sales
MYSQL计算两个字段日期差
标签:amp time tle when 字符串转换 interval ace 转换 net