On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE <eugenetuyizere@gmail.com> wrote:
Dear Sebatian,This is what I get:SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-07 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-08 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-09 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-10 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-11 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-12 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-13 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-14 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-15 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-16 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-17 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-18 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-19 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-20 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-21 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-22 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-23 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-24 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-25 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-26 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-27 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-28 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-29 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-30 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-31 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-06-01 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-06-02 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULLOn Wed, 2 Jun 2021 at 21:53, Sebastian Jung <sebastian.jung2@gmail.com> wrote:Hi Eugene,Please make Print(report.query) then you get SQL querys and Most of time i get an Idea what's wrongRegards--Eugene TUYIZERE <eugenetuyizere@gmail.com> schrieb am Mi., 2. Juni 2021, 21:41:Dear Team,--I need help. I am working on a project where one of the tables is about requests. I want to have a report of the number of requests on each day in the last 30 days, something like this:def reqChart(request):current_date = date.today()days_before = date.today()-timedelta(days=30)for dt in daterange(days_before,current_date):reports = Customer_Requests.objects.filter(arrival_date__gte=dt).\extra({'day':"date(arrival_date)"}).\values('arrival_date').annotate(count=Count('request_name'))print(reports)And I need help--Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38eugenetuyizere@gmail.comEmail: eugene.tuyizere@aims-cameroon.orgTUYIZERE EugeneMsc Degree in Mathematical ScienceAfrican Institute for Mathematical Sciences (AIMS Cameroon)
Crystal Garden-Lime, CameroonBsc in Computer ScienceUR-Nyagatare Campus
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHstWyfMVKQhJb%3DxGKff3p3V%2BFQ_w3DkYVpOe-pEW2ySKg%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKGT9myp4HU6%2BZo6d-JqeaTPsevFBMi_DzU_xuwo3LUja%3DxzRw%40mail.gmail.com.
--Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38eugenetuyizere@gmail.comEmail: eugene.tuyizere@aims-cameroon.orgTUYIZERE EugeneMsc Degree in Mathematical ScienceAfrican Institute for Mathematical Sciences (AIMS Cameroon)
Crystal Garden-Lime, CameroonBsc in Computer ScienceUR-Nyagatare Campus
TUYIZERE Eugene
Msc Degree in Mathematical Science
African Institute for Mathematical Sciences (AIMS Cameroon)
Crystal Garden-Lime, Cameroon
Crystal Garden-Lime, Cameroon
Bsc in Computer Science
UR-Nyagatare Campus
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHtJhxd3-B%3DpzsAhqg_kR68zTvbJKd%2BgeBUqRjGMP%2BxgxQ%40mail.gmail.com.
No comments:
Post a Comment