首页 > 其他 > 详细

full join no满连接的使用

时间:2017-07-26 19:14:37      阅读:261      评论:0      收藏:0      [点我收藏+]


查询各个部门工资范围,按照1000~2000,2000~3000.。。。这样的格式显示人数

select * from (select job,count(*) as "1000~2000" from
(select sal,job from emp
where sal<=2000 and sal>=1000)
group by job) a
full join
(select job,count(*) as "2000~3000" from
(select sal,job from emp
where sal<=3000 and sal>2000)
group by job) b
on a.job=b.job
full join (select job,count(*) as "3000~4000" from
(select sal,job from emp
where sal<=4000 and sal>3000)
group by job) c
on b.job=c.job
full join  (select job,count(*) as "4000~5000" from
(select sal,job from emp
where sal<=5000 and sal>4000)
group by job) d
on d.job=c.job

full join no满连接的使用

原文:http://www.cnblogs.com/hyx0920/p/7241343.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!