Re: SQL query to django

2021-10-10 Thread Eugene TUYIZERE
Thank y'all On Sun, 10 Oct 2021 at 11:49, Sebastian Jung wrote: > Hello Eugene, > > You can also take a raw query... > > https://docs.djangoproject.com/en/3.2/topics/db/sql/ > > Regards > > Eugene TUYIZERE schrieb am Sa., 9. Okt. 2021, > 10:52: > >> Dear all, >> >> I have a table let call it *Y

Re: SQL query to django

2021-10-10 Thread Sebastian Jung
Hello Eugene, You can also take a raw query... https://docs.djangoproject.com/en/3.2/topics/db/sql/ Regards Eugene TUYIZERE schrieb am Sa., 9. Okt. 2021, 10:52: > Dear all, > > I have a table let call it *YY*. Some fields in this table are status, > time_frame, etc. > time frame is in terms o

Re: SQL query to django

2021-10-09 Thread carlos
ok, try this but is only idea (i don't is working) from django.db.models import Count result = (YY.objects .values('time_frame','status') .annotate(timecount=Count('time_frame')) .order_by('status') ) read this for understand https://docs.djangoproject.com/en/3.2/topics/db/aggregatio

SQL query to django

2021-10-09 Thread Eugene TUYIZERE
Dear all, I have a table let call it *YY*. Some fields in this table are status, time_frame, etc. time frame is in terms of years and status are Not started, In progress and Completed. I want to display all services Not started, in progress and completed in each year. And at the end to display thi