mysql> SET @test = 123;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @test2=@test;
+--------------+
| @test2=@test |
+--------------+
| NULL |
+--------------+
1 row in set (0.00 sec)
mysql> SELECT @test2:=@test;
+---------------+
| @test2:=@test |
+---------------+
| 123 |
+---------------+
1 row in set (0.00 sec)
mysql>
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/842357