You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project, I generate a group by clause of a query dynamically from a specified field list.
In PostgreSQL, it is possible to refer to an output column in a group by clause by its ordinal number, such as in the following example:
selectt.c, count(*)
from t
group by1
Currently, I am using slonik's raw tag to place a literal number into a query based on which fields need to be put into a group by clause, such as in the following snippet:
Is it possible to do it without the use of raw tag?
I thought, that literalValue may help, but it accepts only strings. Is there a reason not to allow other primitive values to be used with that function? Thank you.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In my project, I generate a
group by
clause of a query dynamically from a specified field list.In PostgreSQL, it is possible to refer to an output column in a group by clause by its ordinal number, such as in the following example:
Currently, I am using slonik's
raw
tag to place a literal number into a query based on which fields need to be put into a group by clause, such as in the following snippet:Is it possible to do it without the use of
raw
tag?I thought, that
literalValue
may help, but it accepts only strings. Is there a reason not to allow other primitive values to be used with that function? Thank you.Beta Was this translation helpful? Give feedback.
All reactions