Check out how to get around subselect queries in the manual. But incase your query is a little complex and cannot be solved as explained in the manual, use temporary table(s).
When I had this problem I went round it using MySQL Temporary tables. So in your case, you can do something like: >CREATE TEMPORARY TABLE Hein SELECT * FROM table1 ORDER BY var1 LIMIT 0,39 >SELECT * FROM Hein ORDER BY var2; It works fine and fast as well in my applications. Hope this solves your problem. Best Regards, 'Gbamila ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 04, 2002 10:57 AM Subject: getting around a subselect > > As a novice in (My)sql I encounter this problem: > > I would like to select from a table first the 39 records with the highest > variable1 and order them on variable2. > So I need something like a subselect and I can't figure out a way around it. > > Ideally something like: > select * from table1 order by var2 in (select * from table1 order by var1 limit > 0,39); > > Best regards > Hein > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php