I've been asked to solve a "n-th highest salary" problem without using a WINDOW function.
Solution:
1) a first CTE with ordered salaries in descending order limit to n row. (e.g. if it's the 3rd highest salaries then LIMIT 3)
2) Another CTE reversing the order of the above one limited to the first row. (LIMIT 1)
note: it only works if there …
note: it only works if there are no rows with duplicated salaries
note2: LIMIT and OFFSET weren't allowed
If LIMIT is not allowed in steps 1 and 2, you have used LIMIT. Is this something wrong in my understanding
For your security, we need to re-authenticate you.
Click the link we sent to , or click here to sign in.
I've been asked to solve a "n-th highest salary" problem without using a WINDOW function.
Solution:
1) a first CTE with ordered salaries in descending order limit to n row. (e.g. if it's the 3rd highest salaries then LIMIT 3)
2) Another CTE reversing the order of the above one limited to the first row. (LIMIT 1)
note: it only works if there are no rows with duplicated salaries
note2: LIMIT and OFFSET weren't allowed
If LIMIT is not allowed in steps 1 and 2, you have used LIMIT. Is this something wrong in my understanding