When using the NTILE() function in SQL Server, we must include an OVER clause clause with an ORDER BY clause.
If you’re getting error msg 4112 that reads “The function ‘NTILE’ must have an OVER clause with ORDER BY” when using the NTILE() function, it’s because, although you’re (correctly) including an OVER clause, you’re omitting the ORDER BY clause.
To fix this error, add an ORDER BY clause to the OVER clause.