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

10.4 补充范围内丢失的值

时间:2017-09-14 23:57:30      阅读:363      评论:0      收藏:0      [点我收藏+]

标签:mod   ext   count   coalesce   read   oal   ada   ast   sele   

select y.yr.coalesce(x.cnt,0) as cnt
from (
select min_year-mod(cast(min_year as int),10)+rn as yr
from (
select (select min(extract(year from hreadate))
from emp) as min_year,
id-1 as rn
from t10
) a
) y
left join
(
select extract(year from hredate) as yr,count(*) as cnt
from emp
group by extract(year from hiredate)
) x
on (y.yr=x.yr);

10.4 补充范围内丢失的值

标签:mod   ext   count   coalesce   read   oal   ada   ast   sele   

原文地址:http://www.cnblogs.com/liang545621/p/7523351.html

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