mysql实现ROW_NUMBER() sql 排名

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

select *,(@rowNo:=@rowNo+1) as pm
	from(
		select  id,sum(value) as sumValue
		from 
			youTable as p
		where 
			p.date 
		BETWEEN 
				DATE_FORMAT('2014-06-01','%Y-%m-%d 00:00:00') AND DATE_FORMAT('2014-07-04','%Y-%m-%d 23:59:59')
		group by 
			id
		order by 
			sumValue
		desc
)as rs
,(select @rowNo:=0) pm