我如何在Oracle中执行此查询 [英] How can I perform this query in oracle
本文介绍了我如何在Oracle中执行此查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
能否请您指导我进行与Oracle中此查询等效的操作:
Can you please guide me to the equivalent to this query in Oracle:
SELECT SQL_CALC_FOUND_ROWS * FROM tableName
SELECT FOUND_ROWS() as cnt
谢谢
推荐答案
查询从tableName
检索所有行,然后在tableName
中检索行数.使用SQL_CALC_FOUND_ROWS
进行此操作只是性能优化:它使您不必执行两次查询.
The query retrieves all rows from tableName
, and then retrieves the number of rows in tableName
. Doing that with SQL_CALC_FOUND_ROWS
is just a performance optimization: it saves you from doing two queries.
如果性能不是问题,那么Oracle的等效项将是:
If performance is not an issue, an equivalent for Oracle would be:
SELECT * FROM tableName
SELECT count(*) from tableName
如果您可以重写客户端,则可以在一个查询中同时进行:
If you are in a position to rewrite the client, you could do both in one query:
SELECT *
, (SELECT count(*) from tableName) as totalRows
FROM tableName
这篇关于我如何在Oracle中执行此查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文