N
N
newvasyuki2021-02-06 07:44:57
Django
newvasyuki, 2021-02-06 07:44:57

How to assemble the equivalent of the following request with an ORM?

select count(*) as total, count(distinct(uuid)) as uniq from visits;

With the help of orm, I can’t collect something - when using annotate, group by is added. I tried with union - I don't understand how to collect count()'s

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2021-02-06
@newvasyuki

So not annotate is needed, but aggregate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question