3 ms·
SQLite would describe this as a feature, because it's a PITA do that type of query otherwise - window functions with rank() or row_number(), or a self-join. (Ob
by barrkel 3y ago
SQLite would describe this as a feature, because it's a PITA do that type of query otherwise - window functions with rank() or row_number(), or a self-join. (Obviously this specific query could be done with ORDER BY salary DESC LIMIT 1 but if you want the highest paid employee per team or department etc...)
- _a_a_a_ 3y ago> but if you want the highest paid employee per team or department That's straightforward, no? max(salary) over(partition by emp, dept order by salary desc) as top_emp ... where top_emp = 1 (You need to put the window in a subquery)