With a date field I can do this:
ORDER BY ABS(expiry - CURRENT_DATE)
With a timestamp field I get the following error:
function abs(interval) does not exist
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This works (and gives the correct sorting):
Unfortunately, as Erwin Brandstetter pointed out, it reduces the granularity of the sorting to a full day.