MySQL Forums
Forum List  »  Newbie

Re: Two types of sorting into one request
Posted by: Jay Pipes
Date: June 24, 2005 02:29PM

Use a UNION with ORDER BY NULL on outermost result to prevent MySQL from sorting:

(
SELECT *
FROM YourTable
WHERE date > DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
ORDER BY weith
)
UNION ALL
(
SELECT *
FROM YourTable
WHERE date <= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
ORDER BY date, weith
) ORDER BY NULL;

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
Re: Two types of sorting into one request
June 24, 2005 02:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.