I am outputting a table that has a user's response with the period of time that has elapsed next to it
John Smith | Yes (15 mins ago)
Bob Jones | No ( 12 days ago)
Sally Thomas | Yes (1 month ago)
I have a table that holds the last updated time, but am having trouble getting the elapsed time. I know that I can get the interval doing:
SELECT NOW() - last_updated
And I know that I can use the EXTRACT or DATE_PART functions to get the value that I need, but I want it to round to the nearest unit such as seconds, minutes, hours, days, weeks, months, years
I would prefer to not use PHP to do the calculations. Any thoughts?