New answers tagged order-by
You're going to have to make your application not put the ORDER BY inside the subquery (maybe it has an option to not use a needless subquery in the first place). As you've already discovered, this syntax is not supported in SQL Server without TOP. And with TOP, unless you want to leave some rows out, using TOP 100 PERCENT is going to render the ORDER BY ...
I admit this is sleazy but if you're in a pinch try returning the top number of rows in the subquery. Returning the top 100 percent doesn't work but if you want to go through the trouble you can query the number of rows and pass that to TOP as a variable. I tested this on a database set to compatability level 80 so I think it should work with SQL 2000. ...
I agree with zxc that your instructions are not clear. However I think what you are asking for is to get the highest number and group together all the letters that have an instance of that number. Then go to the next highest number. Is correct? I did this in SQL Server but it ought to work in MySQL as well. --populate my temp table. I threw in some D's ...
I did an upgrade to percona mysql 5.6 and it solves a problem. Both type of queries runs equally. Fortunately - equally fast.
Top 50 recent answers are included