I have to find out count of records which were created before 2 hours and which were created in last two hours. I can find that using
[ created in last two hours ]
select count(*)
from trans_calc
where
I_TRACKING_CODE = 112
and d_entered > (current_timestamp - 2 hours)
[ created prior to two hours ]
select count(*)
from trans_calc
where
I_TRACKING_CODE = 112
and d_entered < (current_timestamp - 2 hours)
Can we merge these two sqls or infact can we write a single sql which can give us the desired output?