WQ Query post meta date comparison

You have a bit of a problem. The only human calendar format that sorts correctly is YYYY/MM/DD, the separators are optional. You have DD/MM/YYYY. Whoever decided to store in that format made a bad decision.

Your best option is to correct that design decision and convert those dates to YYYY-MM-DD or to a Unix Timestamp. You can also use MySQL’s date format of YYYY-MM-DD HH:MM:SS but you don’t have hours minutes and seconds. That should be fairly simple. You’d query the database, use PHP to change the format, and save the new dates back to the database. If you do that you can use normal WordPress tools, such as WP_Query, to retrieve the information. Of course, you’d also have to alter whatever code created the problem in the first place.

Otherwise you will have to do something like this:

SELECT CONCAT(
  RIGHT(columnname,4),
  SUBSTR(columnname,4,2),
  LEFT(columnname,2)
) AS date
FROM `tablename`
WHERE id = 1
ORDER BY date

And you will not be able to use WordPress Core tools for the queries. WP_QueryMySQL really– can sort alphabetically(ish) or numerically but not “calendarmerically”. To sort according to a calendar date you have to get the date into a format that sorts numerically or one that MySQL’s built in date functions can deal with. I should also note that that query is not likely to be very efficient.