SELECT FirstName, @flag:=1 AS flag FROM user; 

上述指令就在select的时候给flag字段赋值为1了。

整理自:http://www.nowamagic.net/librarys/topics/detail/378/

Related Posts: MySQL如何在SELECT语句中给字段赋值 :