oracle自带总页数分页sql

时间:2021-10-16 03:26:23

string strSQL = string.Format(@"select * from( with temp as (select * from * where {0} order by CREATE_TIME DESC)
                                                select (select count(1) from temp) total_row, temp.* from temp where rownum = 1 union all
                                                select * from (select rownum total_row,temp.* from temp where rownum <= {2})  where total_row > {1})", strWhere, (pageindex - 1) * pagesize, pageindex * pagesize);