Mega Code Archive

 
Categories / MySQL / Select Clause
 

To set a variable explicitly to a particular value, use a SET statement

mysql> SET syntax uses = rather than := to assign the value: mysql> mysql> mysql> SET @sum = 4 + 7; Query OK, 0 rows affected (0.00 sec) mysql> SELECT @sum; +------+ | @sum | +------+ |   11 | +------+ 1 row in set (0.00 sec) mysql> mysql>