SQL——sql年龄段查询

select *
  from 表 p
 where p.gender <> ''
   and floor(months_between(sysdate, p.Birthday) / 12) <= 49
   and floor(months_between(sysdate, p.Birthday) / 12) >= 15
select * 
  from table p   
where p.gender=''
  and
    floor(months_between(sysdate, p.Birthday)/12)<49
  and
    floor(months_between(sysdate, p.Birthday)/12)>15

 
查询出所有年龄在15~49岁的非男性的信息

逃避不一定躲得过,面对不一定最难过
原文地址:https://www.cnblogs.com/yangzhenlong/p/3242762.html