Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with vtab as (
- select
- t.*,
- count(*) over() as cnt,
- row_number() over(order by col1) as rn
- from table_name t
- where ...
- )
- select col1, col2, col3, ..., cnt
- from vtab
- where rn <= 10
- select rownum as rn, p.*, t.qty
- from
- (
- select count(*) as qty
- from table_name
- where ...
- ) t
- cross /* left */ join
- (
- select *
- from table_name p
- where ...
- -- order by ...
- ) p
- where (rownum <= 10)
Add Comment
Please, Sign In to add comment