having clause #979
YuriFontella
started this conversation in
General
Replies: 1 comment 1 reply
-
You could do something like this: query = (
Tickets
.select(Raw("count(distinct date_trunc('day', played_at)) as days"))
.where(And(Tickets.played_date > start, Tickets.played_date < end))
.group_by('customer_id')
.columns('customer_id', 'days')
)
response = await Tickets.raw('{} HAVING ...', query.querystrings[0])) It shouldn't be too hard to add a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello, I'm trying to create this sql query but there is no having function in the orm, I already looked for a solution in the documentation and in the discussions and issues
What is the best way to implement this?
Beta Was this translation helpful? Give feedback.
All reactions