3 ms·
If you only want maximum of one column, the PRQL is quite simple: from my_table group column_a ( aggregate (max column_b) ) If you want the
by aerzen 4y ago
If you only want maximum of one column, the PRQL is quite simple:
from my_table
group column_a (
aggregate (max column_b)
)
If you want the row with the maximum value it gets interesting:
from my_table
group column_a (
sort [-column_b]
take 1
)
You can read more about group here: https://prql-lang.org/book/transforms/group.html https://prql-lang.org/book/transforms/group.html
- beaugunderson 4y agoOpened an issue as I couldn't get this to work against sqlite: https://github.com/prql/prql/issues/695 https://github.com/prql/prql/issues/695
- maximilianroos 4y agoThanks a lot for testing and opening an issue! This is now fixed and released [1]. Let us know if you still face any problems. (We need better tests against real DBs, which is very much on our roadmap) [1]: https://github.com/prql/prql/pull/698 https://github.com/prql/prql/pull/698
- beaugunderson 4y agoThank you for the amazingly quick fix!