I've read multiple posts and find nothing wrong with my syntax, can someone point out the error?
I am testing some queries in PHP MyAdmin, on a WordPress Database. The table I am querying has a meta_key of "Listing-End-Date" and meta_values of "2018/06/30".
My query looks like this:
SELECT * FROM `table`
WHERE `meta_key` LIKE 'Listing-End-Date'
AND STR_TO_DATE('meta_value', '%Y/%m/%d') > CURDATE()
and it returns 0 results. To test my STR_TO_DATE format, I did a new query:
SELECT `meta_key` , STR_TO_DATE( 'meta_value', '%Y/%m/%d' )
FROM 'table'
WHERE `meta_key` LIKE 'Listing-End-Date'
I get the expected 1 result returned, but the date is NULL. Is it because I am using PHP My Admin or did I type something wrong?
Meta_value should be ticked and not quoted inside string_to_date