-2
私は週ごとに選択し、その週に何枚のチケットが売られたかを数えようとしています。WEEKで選択して、postgresqlとDjangoで数える方法
私はEVENT IDを使用してチケットを選択します。
WHERE EVENT ID 148
SAMPLE DATA: TICKETS TABLE
-------------------------------------------------
"General";0;"2016-09-02 17:50:45.644381+00"
"General";0;"2016-09-03 21:05:54.830366+00"
"General";0;"2016-09-02 18:21:33.976451+00"
"Early Bird";500;"2016-09-09 19:15:33.721279+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Post Secondary Student";1000;"2016-09-06 14:46:53.90927+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"General";0;"2016-09-01 23:50:05.034436+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Post Secondary Student";1000;"2016-09-06 14:46:53.90927+00"
"Post Secondary Student";1000;"2016-09-06 14:46:53.90927+00"
"General";0;"2016-09-03 18:39:15.571188+00"
"General";0;"2016-09-07 20:14:35.959517+00"
"General";0;"2016-09-03 21:33:04.349198+00"
"General";0;"2016-09-07 18:21:22.220223+00"
"General";0;"2016-09-01 23:34:55.773516+00"
"General";0;"2016-09-01 23:42:15.498778+00"
"Early Bird";500;"2016-09-09 19:15:33.721279+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"RSVP";0;"2016-09-27 21:27:33.378934+00"
"RSVP";0;"2016-09-14 22:23:04.922607+00"
"RSVP";0;"2016-09-14 22:23:04.922607+00"
"General Admission";0;"2016-09-23 15:35:54.972803+00"
"General Admission";0;"2016-09-23 15:35:54.972803+00"
"RSVP";0;"2016-09-14 22:23:04.922607+00"
"RSVP";0;"2016-09-14 22:23:04.922607+00"
"General";1000;"2016-09-09 19:15:33.72771+00"
"General Admission";0;"2016-09-23 15:35:54.972803+00"
"General Admission";0;"2016-09-23 15:35:54.972803+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"RSVP";0;"2016-09-14 22:23:04.922607+00"
"RSVP";0;"2016-09-14 22:23:04.922607+00"
"General Admission";0;"2016-09-23 15:35:54.972803+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"Youth";0;"2016-09-06 14:46:53.903704+00"
"General Admission";0;"2016-09-23 15:35:54.972803+00"
"General Admission";0;"2016-09-23 15:35:54.972803+00"
"Free Admission";0;"2016-10-03 19:12:12.965369+00"
"Free Admission";0;"2016-10-06 19:00:25.926406+00"
"Free Admission";0;"2016-10-06 19:00:25.926406+00"
どのように私はそれを達成するだろうか?
私はDAY BY見つけてカウントするようにこれをしなかった:
Ticket.objects.filter(event_id=event_id, event_ticket_id=ticket_type.id, refunded=False).extra(where=('created',),
select={'date_sold':'date(created)'}).values('date_sold').annotate(sold_count=Count('id'))
が、週によって行うことができませんでした。
はここ
私は日に何をしたのですか –