在某些特定条件下,从数据库中查寻List数据的时候,需要给每组数据带上一个key序号。具体实现代码如下:
1 2 3 4 5 6 7 |
SELECT (@i:= @i+1) as 'key', c.country_name as countryName, c.country_code as countryCode FROM country c, (SELECT @i:=0) as i |
from:https://blog.csdn.net/weixin_41848005/article/details/123867009