SELECT t.id,m.Rank from t_assess_log t
LEFT JOIN
(SELECT @counter:=@counter+1 AS Rank,id,build_no,UNIT_PRICE as Roll FROM t_assess_log,(SELECT @counter:=0) AS t
ORDER BY UNIT_PRICE ASC ) m on t.id = m.id where t.id = 164;
用它就可以实现按需所求~~~
锁定老帖子 主题:SQL 伪列排序经典语句
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2015-01-26
SELECT t.id,m.Rank from t_assess_log t LEFT JOIN (SELECT @counter:=@counter+1 AS Rank,id,build_no,UNIT_PRICE as Roll FROM t_assess_log,(SELECT @counter:=0) AS t ORDER BY UNIT_PRICE ASC ) m on t.id = m.id where t.id = 164;
用它就可以实现按需所求~~~ 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |