Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5530

kakashi20 on "Sql by date custom fields wordpress"

$
0
0

I have this SQL query that extracts the year and month of " post_date " posts

$query = "SELECT YEAR(post_date) asyear, MONTH(post_date) asmonth`
FROM $wpdb->posts
WHERE post_type = '$t'
AND post_status = 'publish'
GROUP BY year, month
ORDER BY year DESC, month ASC";`

but I wonder , how I can do the same query but instead of " post_date " would be a date field created by the custom fields plugin.

Thank you


Viewing all articles
Browse latest Browse all 5530

Trending Articles