设为首页 加入收藏

TOP

一套SQL经典的面试题及答案(二)
2014-11-24 01:01:25 来源: 作者: 【 】 浏览:30
Tags:一套 SQL 经典 试题 答案
e when b.mon=1 then b.yj else 0 end) as ‘一月份’,
sum(case when b.mon=2 then b.yj else 0 end) as ‘二月份’,
sum(case when b.mon=3 then b.yj else 0 end) as ‘三月份’,
sum(case when b.mon=4 then b.yj else 0 end) as ‘四月份’,
sum(case when b.mon=5 then b.yj else 0 end) as ‘五月份’,
sum(case when b.mon=6 then b.yj else 0 end) as ‘六月份’,
sum(case when b.mon=7 then b.yj else 0 end) as ‘七月份’,
sum(case when b.mon=8 then b.yj else 0 end) as ‘八月份’,
sum(case when b.mon=9 then b.yj else 0 end) as ‘九月份’,
sum(case when b.mon=10 then b.yj else 0 end) as ‘十月份’,
sum(case when b.mon=11 then b.yj else 0 end) as ‘十一月份’,
sum(case when b.mon=12 then b.yj else 0 end) as ‘十二月份’,
from table2 a left join table1 b on a.dep=b.dep


8.华为一道面试题
一个表中的Id有多个记录,把所有这个id的记录查出来,并显示共有多少条记录数。
——————————————
select id, Count(*) from tb group by id having count(*)>1
select * from(select count(ID) as count from table group by ID)T where T.count>1


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Oracle DBA面试题及参考答案 下一篇Pass-by-value Pass-by-reference..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: