亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

java - Encountering problems with paging queries in Oracle database
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-17 10:04:43
0
2
852

It’s like this. There is a field KS_ZKZ in my table. This field is not unique in the table. Each student number appears multiple times. Now I want to perform paging query based on this student number:
First remove duplicate student numbers and arrange them in ascending order:

SELECT DISTINCT(KS_ZKZ) from ZK.T_BYSQ_KS_KC ORDER BY KS_ZKZ ASC

After having this query result, I want to query the data from rownum a to b of this result:

SELECT KS_ZKZ,ROWNUM FROM
(SELECT DISTINCT(KS_ZKZ) from ZK.T_BYSQ_KS_KC ORDER BY KS_ZKZ ASC)
WHERE ROWNUM >=10 AND ROWNUM<=20

But a problem arises: The following are the query results. .

Why can’t it be found?

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證0級(jí)講師

reply all(2)
PHPzhong

rownum is just a pseudo column. You just need to check the rownum in the layer inside, for example

SELECT KS_ZKZ FROM
(SELECT DISTINCT(KS_ZKZ), ROWNUM rn from ZK.T_BYSQ_KS_KC ORDER BY KS_ZKZ ASC)
WHERE rn between 10 AND 20 
某草草

The judgment of rownum must start with 1. For example, =1 and <5 are all valid, but =2 and >7 must first find out the result set and then query through sub-statements (rownum requires an alias)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template