mysql 之 根据字段 排名

语句写法:

select * from  coca_user a where a.integral>(select b.integral from coca_user b where b.bsid=? and b.integral!=0) and a.integral!=0

 解释:

    查询出  比a的 integral  字段值 大的数据,从而得知排第几名。

猜你喜欢

转载自lgclove1314.iteye.com/blog/2312288