select sum(case when to_char (date_time,'mm') between 1 and 6 then a else 0 end) as one_six_mon, sum(case when to_char (date_time,'mm') between 7 and 12 then a else 0 end) as sev_twe_mon, sum(case when to_char (date_time,'yyyy') < 2019 then a else 0 end) as less_than_year from A;