in reply to Re^2: (OT) MySQL query to limit and sort
in thread (OT) MySQL query to limit and sort
If all the "foo" fields are distinct, the sort short-circuits and never considers bar or baz.sort { $a->{foo} cmp $b->{foo} || $b->{bar} cmp $a->{bar} || $a->{baz} cmp $b->{baz} }
And that's exactly why I offered the sub-select as a solution: first grab the 10 most recent id's, then sort those on Total. You have to do the ordering in two steps, no way around that.
|
|---|