MySQL user-defined variable in WHERE clause

前端 未结 4 1259
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-18 19:20

I want to know if there is a way to use a user-defined variable in WHERE clause, as in this example:

SELECT id, location, @id := 10 FROM songs W         


        
4条回答
  •  醉梦人生
    2020-12-18 19:43

    This worked for me!

    SET @identifier = 7;
    SELECT * FROM test where identifier = @identifier;
    

提交回复
热议问题