Skip to content
Advertisement

Does Mysql have an equivalent to @@ROWCOUNT like in mssql?

How can I get row count values in MySQL as @@ROWCOUNT does in mssql?

Advertisement

Answer

For SELECTs you can use the FOUND_ROWS construct (documented here):

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).

For UPDATE/DELETE/INSERT, it’s the ROW_COUNT construct

which will return the number of affected rows.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement