【发布时间】:2021-11-27 11:20:25
【问题描述】:
【问题讨论】:
-
MySQL 不支持 Pivot。模拟(条件聚合或动态 SQL)。
-
如果超过 6 行怎么办? 5个怎么样?
【问题讨论】:
MySQL 不支持透视和反透视
你能做什么?
select id,attendence_remark_code_val, 'a' col, a value
from attendance
union all
select id,attendence_remark_code_val, 'b' col, b value
from attendance
union all
select id,attendence_remark_code_val, 'c' col, c value
from attendance
【讨论】: