krot

WHERE текущий месяц

Oct 9th, 2017
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Данные за текущий месяц
  2. ... WHERE MONTH(`date`) = MONTH(NOW()) AND YEAR(`date`) = YEAR(NOW())
  3. Данные за текущую неделю
  4. ... WHERE YEAR(`date`) = YEAR(NOW()) AND WEEK(`date`, 1) = WEEK(NOW(), 1)
  5. Данные за предыдущий месяц
  6. ... WHERE MONTH(`date`) = MONTH(DATE_ADD(NOW(), INTERVAL -1 MONTH)) AND YEAR(`date`) = YEAR(NOW())
RAW Paste Data