Reputation: 1
I want to sort the results in a descending order of the total number of times each statement has been executed.
Statements executed:
SELECT CONVERT (argument USING utf8)
FROM mysql.general_log
WHERE argument LIKE '%SELECT%'
OR argument LIKE '%INSERT%'
OR argument LIKE '%DELETE%'
OR argument LIKE '%UPDATE%';
Upvotes: -1
Views: 393
Reputation: 1578
Try
SELECT argument, count(*) FROM mysql.general_log WHERE argument LIKE '%SELECT%' OR argument LIKE '%INSERT%' OR argument LIKE '%DELETE%' OR argument LIKE '%UPDATE%' GROUP BY argument ORDER BY count(*) desc
Upvotes: 0