multiple values in mysql variable

后端 未结 6 2121
渐次进展
渐次进展 2021-02-05 13:49

The following works as expected when there is a single value stored in a variable.

SET @a := \"20100630\";
SELECT * FROM wordbase WHERE verified = @a;
         


        
6条回答
  •  遇见更好的自我
    2021-02-05 13:57

    Using GROUP_CONCAT and GROUP BY one could pull all values ( i.e. an id ) into a variable like so:

    SET @var := (SELECT GROUP_CONCAT(id) FROM `table` WHERE `verified` = @verified GROUP BY verified);
    

提交回复
热议问题