I have two queries:
SELECT id, max(index) from table;
and
SELECT id, index from table where index=(select max(index) from table);
Is there any difference between the two?
I ran the code in MySQL Query Browser and found that the results are the same. But I just feel that there should be a difference. If there is a diff, mind to attach a simple scenario?
Edit: the index
is not unique.
Edit: You might say that my first query is missing group by
; but it is actually working in mysql. I just want to know what's the diff between the two, not the diff between first query with group by
and the second one.