0
在這個SQL查詢中有25條記錄 我想得到5到10之間。我該怎麼做? 我用11克Oracle數據庫Rownum之間
select
(
select count(*) as sayfasayisi
from konular t
where t.kategori is not null
) as sayfasayisi,
t.id,
t.uye,
t.baslik,t.mesaj,t.kategori,t.tarih,
t.edittarih,t.aktif,t.indirimpuani,t.altkategori,t.link,
nvl(
(select case when t.id = f.konuid and f.uye = 'test' then '1' else '0' end
from takipkonu f where t.id = f.konuid and f.uye = 'test'), '0') as takip
from konular t
where t.kategori is not null
Oracle不會爲記錄分配永久行號,所以如果您要查找表中的第5到第10條記錄,請知道它不能保證你每次都會得到相同的記錄。對於您的具體問題,您需要查看您僅檢索這些記錄的具體要求。 – Incognito
您可以使用'ROW_NUMBER()'進行一定的排序,然後只保留第5到第10條記錄。 [見這裏](https://stackoverflow.com/questions/7480243/sql-oracle-order-by-and-limit)。 –