Skip to content
Advertisement

How to manipulate the output after selecting and ordering TOP RESULT

ERROR:

Msg 156, Level 15, State 1, Server NS544979, Procedure , Line 0 Incorrect syntax near the keyword ‘TOP’. [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword ‘TOP’. (156)

I have successfully selected and ordered the PvPExp in the query.

I want to set PVPLEVEL = 26 for the #1 Top result. That isn’t working.

Then from that I want to set The #2-#5 Top result a certain value.

So on and so forth. Please help

Advertisement

Answer

With RANK() window function:

Replace ? with the value that you want to set to #2-#5 Top rows.
If you want to set different values for them also:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement