troubleshooting Question

Sorting mysql query by 2 conditions

Avatar of peps03
peps03 asked on
DatabasesPHPMySQL Server
8 Comments1 Solution628 ViewsLast Modified:

I'm trying to sort a mysql query by 2 conditions: Deadline in future or deadline in past.

The table has a column named 'deadline'. When outputting the result i would like to first show all the deadlines in the future with the nearest first, when all these are outputted, the ones with a deadline in the past should be outputted, with the most recently 'expired' at the top.

Like this, with today being 7 July 2012:
14 July 2012
18 July 2012
05 July 2012
01 July 2012

the results are paginated, so i would like to be able to achieve this with 1 query if that is possible..

Many thanks!
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros