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