Does Mysql have an equivalent to @@ROWCOUNT like in mssql?(Mysql 是否与 mssql 中的 @@ROWCOUNT 等效?)
问题描述
如何像 @@ROWCOUNT
在 mssql 中那样在 MySQL 中获取行计数值?
How can I get row count values in MySQL as @@ROWCOUNT
does in mssql?
推荐答案
对于 SELECT,您可以使用 FOUND_ROWS
构造 (此处记录):
For SELECTs you can use the FOUND_ROWS
construct (documented here):
这将返回最后一个 SELECT
查询中的行数(或者如果第一个查询有一个 LIMIT
子句,它会返回那里将有的行数没有LIMIT
).
which will return the number of rows in the last SELECT
query (or if the first query has a LIMIT
clause, it returns the number of rows there would've been without the LIMIT
).
对于UPDATE
/DELETE
/INSERT
,它是ROW_COUNT 构造
这将返回受影响的行数.
which will return the number of affected rows.
这篇关于Mysql 是否与 mssql 中的 @@ROWCOUNT 等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!