postgresql - Obtain activity history by group by date -
reminder_user table ==================== ruid uid from_date to_date instructions created_timestamp 1 1 1413072000 1413072000 sample 1413072000 2 1 1413072000 1413072000 sample 1413072000 3 2 1413072000 1413072000 sample 1413072000 4 2 1413072000 1413072000 sample 1413072000 5 2 1413072000 1413072000 sample 1413072000 6 3 1413072000 1413072000 sample 1413072000 reminder_setting table ======================= rsid ruid time postpond_status time postpond_time 1 1 1413072000 postpond 1413072000 1413072000 2 1 1413072000 postpond 1413072000 1413072000 3 2 1413072000 postpond 1413072000 1413072000 4 2 1413072000 postpond 1413072000 1413072000 reminder_activity table ======================== raid rsid created_timestamp status 1 1 1413072000 missed 2 2 1413072000 missed
the purpose of above 3 tables are
reminder_user table -- stores reminder setting against particular user reminder_setting table -- stores history of each every postpond activity reminder_activity table -- stores each , every activity against particular reminder settingi struggling postgres query history of records past 30 days grouped togther date available in created_timestamp column in reminder_activity table along limit. help highly appreciated.
result set expected below ============================== date time instruction 10/12/2014 12:00 sample 13:00 sample 10/11/2014 10:00 sample 12:00 sample 13:00 sample date created_timestamp column reminder_activity table time time column reminder_setting table instructions instructions column of reminder_user table postgresql
No comments:
Post a Comment