{"id":214976,"date":"2021-04-11T09:02:07","date_gmt":"2021-04-11T01:02:07","guid":{"rendered":"https:\/\/gulass.cn\/?p=214976"},"modified":"2021-03-28T14:03:13","modified_gmt":"2021-03-28T06:03:13","slug":"oracle-data-paging","status":"publish","type":"post","link":"https:\/\/gulass.cn\/oracle-data-paging.html","title":{"rendered":"Oracle\u5206\u9875"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5e38\u7528\u5173\u7cfb\u6570\u636e\u5e93\u5206\u9875SQL\u90fd\u662f\u4e0d\u76f8\u540c\u7684\uff0c\u4e0d\u8fc7\u5927\u540c\u5c0f\u5f02\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u4e0b\u9762\u662fOracle\u5206\u9875\u7b80\u5355\u4e8b\u4f8b\u56fe\u7247\u4ee5\u53ca\u4ee3\u7801\uff1a<\/p>\n

1\u3001\u666e\u901a\u67e5\u8be2<\/strong><\/div>\n
\r\nselect * from table_Name\u00a0t order by active_count desc;\r\n<\/pre>\n

\"\"<\/p>\n

2\u3001\u67e5\u8be2\u7b2c\u4e00\u6761\u8bb0\u5f55<\/strong><\/div>\n
\r\nselect *\r\n\u00a0\u00a0from (select * from\u00a0table_Name\u00a0order by\u00a0active_count\u00a0desc)\r\n\u00a0where rownum = 1;\r\n<\/pre>\n

\"\"<\/p>\n

\u67e5\u8be2\u524d3\u6761\uff1a\u7c7b\u4f3cSqlserver\u4e2d\u7684TOP 3<\/strong><\/div>\n
\r\nselect *\r\n\u00a0\u00a0from (select * from table_Name\u00a0order by active_count\u00a0desc)\r\n\u00a0where rownum <= 3;\r\n<\/pre>\n

\"\"<\/p>\n

4\u3001\u67e5\u8be2\u7b2c2\u81f3\u7b2c3\u6761\u8bb0\u5f55<\/strong><\/div>\n
\r\nselect *\r\n\u00a0\u00a0from (select t.*, rownum as no\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0from (select * from table_Name order by active_count\u00a0desc) t)\r\n\u00a0where no between 2 and 3\r\n<\/pre>\n

\"\"<\/p>\n

5\u3001\u5728TOP3\u6761\u8bb0\u5f55\u7684\u57fa\u7840\u4e0a\u67e5\u8be2\u7b2c2\u81f3\u7b2c3\u6761\u8bb0\u5f55<\/strong><\/div>\n
\r\nselect *\r\n\u00a0\u00a0from (select t.*, rownum as no\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0from (select * from table_Name order by\u00a0active_count\u00a0desc) t \u00a0where rownum <= 3\u00a0)\r\n\u00a0where no between 2 and 3\r\n<\/pre>\n

\"\"<\/p>\n

6\u3001\u67e5\u8be2\u7b2c2\u6761\u4ee5\u540e\u7684\u8bb0\u5f55<\/strong><\/div>\n
\r\nselect *\r\n\u00a0\u00a0from (select t.*, rownum as no\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0from (select * from table_Name order by\u00a0active_count\u00a0desc) t)\r\n\u00a0where no >=2\r\n<\/pre>\n

\"\"<\/p>\n

\u89e3\u91ca\uff1a<\/p>\n

rownum \u662f\u5728\u5df2\u4ea7\u751f\u6570\u636e\u7684\u57fa\u7840\u4e0a\u4f2a\u751f\u6210\u7684\u7f16\u53f7\uff0c\u6240\u4ee5 \u4f7f\u7528rownum \u5fc5\u987b\u5728\u5df2\u6709\u6570\u636e\u7684\u57fa\u7840\u4e0a\uff0c\u56e0\u6b64Oracle\u5206\u9875\u624d\u52a0\u5165\u4e86\u591a\u4e2a\u5b50\u67e5\u8be2\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e0b\u9762\u662fOracle\u5206\u9875\u7b80\u5355\u4e8b\u4f8b\u56fe\u7247\u4ee5\u53ca\u4ee3\u7801\uff1a select * from table_Name\u00a0t order […]<\/p>\n","protected":false},"author":1903,"featured_media":214990,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-214976","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/214976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1903"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=214976"}],"version-history":[{"count":4,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/214976\/revisions"}],"predecessor-version":[{"id":215074,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/214976\/revisions\/215074"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/214990"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=214976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=214976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=214976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}