MySQL Order by before Group by
In a custom module, I needed to get the latest node that each user published. It is fairly easy to goup by users, but it needs a little something to actually accomplish the sorting.
The following query worked for me, we need to do the sorting in a nested select:
In case the following error comes up:
Error: 1248 - SQLSTATE: 42000 ER_DERIVED_MUST_HAVE_ALIAS