I am trying to run the mysql query to count the record of last one month. Here is the query:
$school_count_last_month = get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_date >= DATE_ADD(LAST_DAY(DATE_SUB(NOW(),INTERVAL 2 MONTH)),INTERVAL 1 DAY) AND post_date <= DATE_SUB(NOW(),INTERVAL 1 MONTH)");
As this query working in phpmyadmin but when I tried to load my website not show anything.
Although, I have tried another sql queries in same page, but they are working perfectly.