码迷,mamicode.com
首页 > 其他好文 > 详细

full join no满连接的使用

时间:2017-07-26 19:22:21      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:格式   group   group by   and   nbsp   显示   count   select   查询   


查询各个部门工资范围,按照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满连接的使用

标签:格式   group   group by   and   nbsp   显示   count   select   查询   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!