MySQL/MariaDB – order by inside subquery
After a bit of digging, I can confirm both your scenarios: MySQL 5.1 does apply the ORDER BY inside the subquery. MariaDB 5.5.39 on Linux does not apply the ORDER BY inside the subquery when no LIMIT is supplied. It does however correctly apply the order when a corresponding LIMIT is given: SELECT t2.Code FROM … Read more