MySQL列转行的用法:## 标题
SELECT
a.employeeId,
MAX( CASE checkType WHEN ‘OnDuty’ THEN userCheckTime END )OnTime,
MAX( CASE checkType WHEN ‘OffDuty’ THEN userCheckTime END ) OffTime
FROM
t_oa_check_work a
GROUP BY
a.employeeId,
a.workDate
MySQL列转行的用法:## 标题
SELECT
a.employeeId,
MAX( CASE checkType WHEN ‘OnDuty’ THEN userCheckTime END )OnTime,
MAX( CASE checkType WHEN ‘OffDuty’ THEN userCheckTime END ) OffTime
FROM
t_oa_check_work a
GROUP BY
a.employeeId,
a.workDate
这篇文章主要介绍了mysql 行转列和列转行实例详解的相关资料,需要的朋友可以参考下 mysql行转列、列转行 语句不难,不做多余解释了,看语句时,从内往外一句一句剖析。一、行转列
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M