Skip to content
Advertisement

Update Selected Column using ORDER BY or base on Higher Value of Other Column

I would like to make a SQL script or statement which has a function of updating the column but it only update the high OnlineTime.

  • DatabaseName: Ranking
  • Table: ChaInfo
  • Columns: UserNum, CharacterName,OnlineTime,Points

Lets say there are 3 column that has the same UserNum but different OnlineTime Record, Then What I want to happen is UPDATE the POINTS of the one that has a highest OnlineTime.

Sample code but its not working:

Please help me to fix this code.Thanks.

Advertisement

Answer

If you want to update row with UserNum=1 and highest onlineTime , try this:

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