Pls explain JOIN (SELECT @rank := 20) in this script


#1

pls explain

JOIN (SELECT @rank := 20)

In this script

UPDATE nconnectz.test
JOIN (SELECT @rank := 20) r
SET route = @rank := @rank + 1
WHERE user = 0

What's it joining on?


#2

Seems like variable assignment (@rank), which has value of 20. Which is later incremented by 1 and used to set value of 21 to the route field. Seemed to work at least in MariaDB.


#3

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.