4 ms·
I disagree. This is a problem with filtering data. Creating a view every time you want 1 row from each group based on some calculation is beyond cumbersome IMHO
by wodenokoto 4y ago
I disagree. This is a problem with filtering data. Creating a view every time you want 1 row from each group based on some calculation is beyond cumbersome IMHO.
- tluyben2 4y agoBut OP says every single time in their post which nicely fits a view as building block for more readable and simpler sql. Their issue seems not a one of filtering problem.
- wodenokoto 4y agoYou can't build a view that allows you to do that query with an arbitrary function instead of MAX. It's _every single time_ you need to do this kind of trivial querying you have to write this convoluted mess of SQL.
- oedo 4y ago>with an arbitrary function instead of MAX Many systems support user-defined aggregates[0][1] [0] https://www.postgresql.org/docs/current/sql-createaggregate.html https://www.postgresql.org/docs/current/sql-createaggregate.... [1] https://docs.oracle.com/en/database/oracle/oracle-database/21/addci/using-user-defined-aggregate-functions.html https://docs.oracle.com/en/database/oracle/oracle-database/2...