Is there any way to simulate rownum in postgresql ?
相关问题
- Django distinct is not working
- PostgreSQL: left outer join syntax
- Connecting Python to a Heroku PostgreSQL DB?
- PostgreSQL - Deleting data that are older than an
- Does PLV8 support making http calls to other serve
相关文章
- postgresql 关于使用between and 中是字符串的问题
- postgresql 月份差计算问题
- Using boolean expression in order by clause
- Table valued Parameter Equivalent in Postgresql
- in redshift postgresql can I skip columns with the
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- PostgreSQL field data type for IPv4 addresses
- Using prepared statement in stored function
If you have a unique key, you may use
COUNT(*) OVER ( ORDER BY unique_key ) as ROWNUM
DEMO
use the limit clausule, with the offset to choose the row number -1 so if u wanna get the number 8 row so use:
limit 1 offset 7
If you just want a number to come back try this.
You can add a order by to the inline_v1 SQL so your ROWNUM has some sequential meaning to your data.
Might not be the fastest, but it's an option if you really do need them.
Postgresql have limit.
Oracle's code:
same in Postgresql's code:
Postgresql > 8.4
Postgresql does not have an equivalent of Oracle's ROWNUM. In many cases you can achieve the same result by using LIMIT and OFFSET in your query.