mysql select语句中显示行的序号自增i++

SELECT s.`id`, (@i:=@i+1) as i FROM store s,(select @i:=0) as x  
ORDER BY i DESC 

select   (@i:=@i+1)   as   i,table_name.*   from   table_name,(select   @i:=0)   as   it   order   by  

例子:
select passport,count(*) as clnumber,'20090301',(@i:=@i+1) as i,'1' from table,(select @i:=0) as it where insert_date>='$gbludate' and insert_date




你可能感兴趣的:(mysql)