8.4 确定两个日期之间的月份数或年数

select mnth,mnth/12
from
(select (year(max_hd) - year(min_hd))*12 +
(month(max_hd) - month(min_hd)) as mnth
from (
select min(hiredate) as min_hd,max(hiredate) as max_hd
from emp
) x
) y;

posted @ 2017-09-14 21:59  屠魔的少年  阅读(210)  评论(0)    收藏  举报