1.查詢數據排序
select * from pa_sm_score order by score desc
表內容:
2.mysql記錄集中記錄序號,MySQL中實現rownum功能類似的語句:
SELECT @rownum:=@rownum+1 rownum,s.* FROM (SELECT @rownum:=0) r,pa_sm_score s order by score desc
表數據
3.查詢定位某條記錄的記錄位置
select t.* from (SELECT @rownum:=@rownum+1 rownum,s.* FROM (SELECT @rownum:=0) r,pa_sm_score s order by score desc) t,pa_sm_score s where t.employee_id=s.employee_id and s.employee_id = 52788