August 29, 2013
Execute query that normally runs on a single ID for every ID
Damien.Bell’s Question:
So I have this query:
SELECT ABS(TIMESTAMPDIFF(MINUTE, NOW(),
(SELECT MAX(`Time`)
FROM ddHistorical
WHERE ID = '5')))
I want to run that on every ID in my database, how would I do that?
Just remove the WHERE
part, it will run on every rows.
SELECT ABS(TIMESTAMPDIFF(MINUTE, NOW(), (SELECT MAX(`Time`) FROM ddHistorical