I have 4 queries I want to combine in one to reduce DB calls. Each interval list the products for that time interval and is used for a specific sub treatment.
select * from product where add_time >= NOW() - INTERVAL '12 hour' (get product add the last 12h)
select * from product where add_time >= NOW() - INTERVAL '24 hour' (get product add the last 24h)
select * from product where add_time >= NOW() - INTERVAL '7 day' (get product add the last week)
select * from product where add_time >= NOW() - INTERVAL '30 day' (get product add the last month)
Is it possible? what will the query look like and how to access each group interval (12h, 24h, 7 day, 30 day) to process the result?
PostgreSQL 9.5.12