Skip to content

Instantly share code, notes, and snippets.

@stvkoch
Last active September 4, 2015 22:45
Show Gist options
  • Save stvkoch/396199 to your computer and use it in GitHub Desktop.
Save stvkoch/396199 to your computer and use it in GitHub Desktop.
tow mysql orders
#Tow mysql orders, more recent first and old lasts!
SELECT IF(dataInitial > NOW(), 0, dataInitial) as dataOrder, dataInitial FROM myTable
ORDER BY dataOrder, dataInitial
#you can created index on the fly!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment