如何计算MYSQL查询中已删除行的数量?

时间:2021-05-27 09:17:11

I'm trying to find out whether a delete query executed properly. I know how many rows its supposed to delete, and I'd like to check that the number that were deleted, matches what's expected, from within the query itself.

我试图找出删除查询是否正确执行。我知道它应该删除多少行,并且我想从查询本身检查已删除的数字是否符合预期。

How do I find out the number of rows that I just deleted, from within a SQL query running against MySQL? Separate statements are fine, as long as I can bundle them into one query.

如何从针对MySQL运行的SQL查询中找出刚刚删除的行数?只要我可以将它们捆绑到一个查询中,单独的语句就可以了。

1 个解决方案

#1


10  

see MySQL ROW_COUNT function here http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count

请参阅MySQL ROW_COUNT函数http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count

#1


10  

see MySQL ROW_COUNT function here http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count

请参阅MySQL ROW_COUNT函数http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count