做网站、滕州网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!/>
- -- 解法一
- SELECT
- t1.teacher_no,
- (CASE WEEK WHEN '1' THEN keshu ELSE 0 END ) 礼拜一,
- (CASE WEEK WHEN '2' THEN keshu ELSE 0 END ) 礼拜二,
- (CASE WEEK WHEN '3' THEN keshu ELSE 0 END ) 礼拜三
- 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 keshu ELSE 0 END ) 礼拜一,
- (CASE WEEK WHEN '2' THEN keshu ELSE 0 END ) 礼拜二,
- (CASE WEEK WHEN '3' THEN keshu ELSE 0 END ) 礼拜三
- 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统计星期的上课数-创新互联
文章链接:/article18/cojsgp.html
成都网站建设公司_创新互联,为您提供软件开发、微信公众号、网站策划、关键词优化、外贸建站、域名注册
广告
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源:
创新互联