Created
June 25, 2019 08:13
-
-
Save alokstha1/5a36cb4f48fc36b7e03968ba066185f5 to your computer and use it in GitHub Desktop.
SQL to get results from the last Month
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$result = $wpdb->get_results("SELECT * FROM `$table` WHERE `user_id` = $user_id $extend AND MONTH(created) = MONTH(CURRENT_DATE()) | |
AND YEAR(created) = YEAR(CURRENT_DATE()) order by id DESC" ); | |
//created being a nave of a date column 2019-04-10 19:03:43 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment