var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: find seconds ago on multi row query
I want to do a query that will return multiple rows (each has a timestamp) and show how many seconds ago that was.
I know how to do it for a single row selection
SELECT TIME_TO_SEC(TIMEDIFF(NOW(), record_timeStamp)) AS ago FROM records WHERE record_id = 12
but im looking more for SELECT TIME_TO_SEC(TIMEDIFF(NOW(), record_timeStamp)) AS ago FROM records so it will output all of them.
When I try this, the "ago" returns with the same value for all of them. I 80% understand why. But dont know how to fix that.
This does seem to work though:
SELECT TIME_TO_SEC(record_timeStamp) - TIME_TO_SEC(NOW()) AS ago FROM records
Is there a better/ faster way? Or is this correct?