mysql鎴栬€卭racle鍒嗙粍鎺掑簭鍙栧墠鍑犳潯鏁版嵁
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql鎴栬€卭racle鍒嗙粍鎺掑簭鍙栧墠鍑犳潯鏁版嵁相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/mysq' title='mysq'>mysq
mysql where 鍒嗙粍 row 鏁版嵁 des sel oraselect a.*
from
(
select t1.*,(select count(*)+1 from 琛?where 鍒嗙粍瀛楁=t1.鍒嗙粍瀛楁 and 鎺掑簭瀛楁<t1.鎺掑簭瀛楁) as group_id
from 琛?t1
) a
where a.group_id<=3
Oracle锛?/p>
SELECT t.*
FROM (SELECT ROW_NUMBER() OVER(PARTITION BY 鍒嗙粍瀛楁 ORDER BY 鎺掑簭瀛楁 DESC) rn,
b.*
FROM 琛?b) t
WHERE t.rn <= 3 ;
以上是关于mysql鎴栬€卭racle鍒嗙粍鎺掑簭鍙栧墠鍑犳潯鏁版嵁的主要内容,如果未能解决你的问题,请参考以下文章