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
以上3个表的目的是
我正在努力获取postgres查询到过去30天的记录历史记录,这些记录按照提醒_活动表中的created_timestamp列中的日期和限制分组。任何帮助都非常感谢。
Result set expected as 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 from created_timestamp Column from reminder_activity table
Time from time Column from reminder_setting table
instructions from instructions column of reminder_user table