Replies: 2 comments
-
Hello @trueqbit . Unfortunately such queries cannot be implemented using |
Beta Was this translation helpful? Give feedback.
0 replies
-
With CTEs it is possible to realize the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to perform a "greatest-n-per-group" query? I guess this belongs to one of the most needed tasks...
In other words: having a table consisting of multiple results for items, I want to select a single result row per item, based on a condition like an aggregated value.
This is possible using a (self) join and filtering by aggregated value (in case it is unique), or using window functions.
Especially because I need a 'self join' I can't figure out how to do this using sqlite_orm.
My specific example, given this table:
Using a (self) join:
Using window functions:
Also see those answers on SO:
SQL select only rows with max value on a column (traditional self join)
SQL select only rows with max value on a column (window function)
Select info from table where row has max date
Beta Was this translation helpful? Give feedback.
All reactions