Here is my table:
-- log
+----+---------+------------+
| id | user_id | seen |
+----+---------+------------+
| 1 | 2342 | 1442664886 |
| 2 | 3244 | 1442665851 |
| 3 | 2342 | 1442711823 |
| 4 | 7654 | 1442864219 |
| 5 | 3244 | 1442954080 |
| 6 | 9984 | 1442984716 |
+----+---------+------------+
I want to get the biggest seen time for a specific user as last seen. I can do that by these two queries:
First query:
SELECT seen AS last_seen
FROM log
WHERE user_id = :id
ORDER BY seen DESC
LIMIT 1
Second query:
SELECT MAX(seen) AS last_seen
FROM log
WHERE user_id = :id
Well which one is the standard way? Should I go with which one? Is there any different in the performance?