Currently my application is running over 2 dbs one is snapshotDB one is evercamDB. In snapshotDB we are saving records now it want to retrieve them , currently am using this query
select camera_id,count(*) as snapshot_count
from snapshots
where snapshot_id in (select snapshot_id
from snapshots
where created_at = 'now'::date - 1)
group by camera_id
what i want is to get records from snapshots such as am considering today is 2016-01-21 and i want to get all records from yesterday. '2016-01-20 00:00:00' to '2016-01-20 23:59:59'. i really dont know how to bind time with 'now'::date - 1 in such format as i have written.
And i want to place this date and time in (select snapshot_id from snapshots where created_at = 'now'::date - 1) so that i can get records as i want.
Any suggestion or help will be appreciated