use uniq for select #113
Answered
by
jayvynl
amin-basiri
asked this question in
Q&A
Replies: 1 comment
-
from clickhouse_backend.models import uniq
from django.db.models import Count
Analytics.objects.annotate(uniq_aid=uniq("aid"))
# You can try this
Analytics.objects.aggregate(count=Count(uniq("aid")))
# This may also work
Analytics.objects.aggregate(count=Count("aid", distinct=True)) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
amin-basiri
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i want to use
uniq
anduniqExact
function on selectand i want something like this:
SELECT uniq(aid) FROM analytics WHERE event_id = 'ksjfes'
or
SELECT count(uniq(aid)) FROM analytics WHERE event_id = 'ksjfes'
Beta Was this translation helpful? Give feedback.
All reactions