I have got this query:
SELECT * FROM `mfw_navnode` n1
WHERE (n1.node_name='Eby' OR n1.node_name='Lana' OR n1.node_name='MF' OR n1.node_name='Amur' OR n1.node_name='Asin' )
GROUP BY n1.node_name
It has another field which is called time_added..that is basically the time of each row..I want to order the node_name (Select them), by the latest time I added them.
How do I do it? each node_name has a time.. but I want to group each node_name by the latest time it was added..
I thought to use MAX(time_added) and then add it to group by..but that gave me an error..
What could be a possible solution?
If I understand the question, the following may be what you are looking for. It isn’t quite clear to me if you want them ordered with the latest times first or last (add
DESCas needed):One thing to note is that the query in the OP, which includes fields not in the GROUP BY clause is ambiguous and is not allowed in most SQL implementations.