I am confused about the inability to use anything
UPDATE Query inside
SELECT Interrogate. I have this idea, it would be amazing to use queries like the following for elegant reporting purposes
My broken code:
SELECT ( UPDATE animals SET status=1 WHERE status=5 ) as 'total_changed_animals', ( UPDATE sports SET status=1 WHERE status=4 ) as 'total_changed_sports';
In the query documents from MySQL it says:
UPDATE returns the number of rows that have actually been changed.
That being said, I would expect the example above
UPDATE Subquery to return the number of changed records in
SELECT Query. However, this does not work and the query example mentioned above fails.
Can anyone explain why it is not allowed? I think there can be a reason for that. Is there a workaround?