An easy way to find 4th highest salary from a table in SQL Server. This might be the 4th highest salary or the 12 highest Sales order for example.
To do this we use a really simple function called RowNumber, I also show you how to add a variable to your code so you can change which Nth value you would like returned. It's really simple and is often a database query that might be used in SSRS reports for example.
Check the video out, and if you want the code or further examples then let me know in the comments below - and remember to Like the video.
Cheers
Content
00:00 Intro
00:48 Analysing the data
01:32 Using RowNumber to find Nth Value
02:29 Using a CTE
03:51 Using a variable to find Nth value