标签:ble test idt top aci nbsp pac case creat
1、 有表如下,请使用查询语句得出相应结果
id |
job |
createdate |
1 |
开发 |
2018-06-19 |
2 |
运维 |
2018-06-20 |
3 |
开发 |
2018-06-19 |
4 |
开发 |
2018-06-20 |
得出如下结果
createdate |
开发 |
运维 |
2018-06-19 |
2 |
0 |
2018-06-20 |
1 |
1 |
答案:
SELECT
aa.createdate,
SUM(
CASE
WHEN aa.job = ‘开发‘ THEN
1
ELSE
0
END
) ‘开发‘,
SUM(
CASE
WHEN aa.job = ‘运维‘ THEN
1
ELSE
0
END
) ‘运维‘
FROM
testtable aa
GROUP BY
aa.createdate;
标签:ble test idt top aci nbsp pac case creat
原文地址:https://www.cnblogs.com/qiankun-site/p/9252269.html