select count(1) from(
select rpt_id from (
select rpt_id,bd,cast(split(cast ((current_date-cast(bd as date))/365 as varchar),' ')[1] as int) age from dataetl.rpt_b
where sex='女' and bd!='' )a where age>=20 and age<=29 group by rpt_id);
select count(1) from(
select rpt_id from (
select rpt_id,bd,date_diff('day',cast(bd as date),cast('2020-01-02' as date))/365 age from dataetl.rpt_b where sex='女' and bd!=''
)a where age>0 and age <=19 group by rpt_id)
presto查询根据出生年月日获取现在的年龄
最新推荐文章于 2022-09-28 14:25:16 发布