Mysql syntax

In answer to another question here in stackoverflow ( How do you select every nth row from mysql ), someone provided this answer:

SELECT * FROM ( SELECT @row := @row +1 AS rownum, [column name]
FROM ( SELECT @row :=0) r, [table name] ) ranked WHERE rownum % [n] = 1 

Can anyone provide or point me more information about using syntax here. I am not familiar with using: =?

(I cannot ask for further clarification in the comments on the points.)

Thanks.

+3
source share
3 answers

From http://dev.mysql.com/doc/refman/5.0/en/user-variables.html :

"For SET, you can use either = or: = as the assignment operator.

, SET. : = not = = , SET:

mysql> SET @t1=0, @t2=0, @t3=0;
mysql> SELECT @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
+----------------------+------+------+------+
| @t1:=(@t2:=1)+@t3:=4 | @t1  | @t2  | @t3  |
+----------------------+------+------+------+
|                    5 |    5 |    1 |    4 |
+----------------------+------+------+------+

"

+2

a = b MySQL a b true, , false . @a := b, , @a b.

, = - ( "" ), := - ( " " ).

EDIT: , = SET, . SELECT := .

+2

For me it looks the same as a =.

0
source

Source: https://habr.com/ru/post/1708278/


All Articles