Since mysql does not enforce the Single-Value Rule
(See: https://stackoverflow.com/a/1646121/1688441) does a derived table with an order by guarantee which row values will be displayed? This is for columns not in an aggregate function and not in the group by
.
I was looking at the question (MySQL GROUP BY behavior) after having commented on and answered the question (https://stackoverflow.com/a/24653572/1688441) .
I don't agree with the accepted answer, but realized that a possible improved upon answer would be:
SELECT * FROM
(SELECT * FROM tbl order by timestamp) as tb2
GROUP BY userID;
http://sqlfiddle.com/#!2/4b475/18
Is this correct though or will mysql still decide arbitrarily which row values will be displayed?