-
-- 解法一
-
SELECT
-
t1.teacher_no,
-
(CASE WEEK WHEN '1' THEN keshuELSE 0END ) 礼拜一,
-
(CASE WEEK WHEN '2' THEN keshuELSE 0END ) 礼拜二,
-
(CASE WEEK WHEN '3' THEN keshuELSE 0END ) 礼拜三
-
FROM
-
(
-
SELECT
-
teacher_no,
-
WEEK,
-
COUNT(1) AS keshu
-
FROM teach
-
GROUP BY teacher_no,WEEK
-
)t1
-
GROUP BY t1.teacher_no;
-
-
-
-- 解法二 就是count()函数作用
-
SELECT
-
t1.teacher_no,
-
(CASE WEEK WHEN '1' THEN keshuELSE 0END ) 礼拜一,
-
(CASE WEEK WHEN '2' THEN keshuELSE 0END ) 礼拜二,
-
(CASE WEEK WHEN '3' THEN keshuELSE 0END ) 礼拜三
-
FROM
-
(
-
SELECT
-
t.teacher_no,
-
t.WEEK,
-
COUNT(t.keshu) AS keshu
-
FROM
-
(
-
SELECT
-
teacher_no,
-
WEEK,
-
'1' keshu
-
FROM teach)t
-
GROUP BY teacher_no,WEEK
-
)t1
-
GROUP BY t1.teacher_no
-
;
站在用户的角度思考问题,与客户深入沟通,找到启东网站设计与启东网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站设计、网站建设、企业官网、英文网站、手机端网站、网站推广、域名注册、网站空间、企业邮箱。业务覆盖启东地区。
文章题目:(一)、根据teacher_no统计星期的上课数
本文URL:https://www.cdcxhl.com/article6/pdhoog.html
成都网站建设公司_创新互联,为您提供外贸建站、面包屑导航、品牌网站建设、手机网站建设、企业建站、品牌网站设计
广告
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源:
创新互联