Geçen Yıl:

SELECT * FROM table WHERE YEAR(date_created) = YEAR(CURRENT_DATE - INTERVAL 1 YEAR);

Geçen Ay:

SELECT * FROM table WHERE MONTH(date_created) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH);

Geçen Hafta:

SELECT * FROM table WHERE WEEK(date_created) = WEEK(CURRENT_DATE - INTERVAL 1 WEEK);

Geçen Gün:

SELECT * FROM table WHERE DAY(date_created) = DAY(CURRENT_DATE - INTERVAL 1 DAY);

Veya şu kodları da kullanabilirsiniz:

SELECT * FROM table WHERE date_created <= NOW() - INTERVAL 1 YEAR;
SELECT * FROM table WHERE date_created <= NOW() - INTERVAL 1 MONTH;
SELECT * FROM table WHERE date_created <= NOW() - INTERVAL 1 WEEK;
SELECT * FROM table WHERE date_created <= NOW() - INTERVAL 1 DAY;

Comments

  1. Douglas Oetken

    Congratulations on your incredible gift for writing! Your article is an engaging and enlightening read. Wishing you a New Year full of achievements and happiness!

  2. goltogel

    The article was engaging and informative. Adding visuals could further enhance its appeal, and my website might have the perfect solution.

Jnuxyl için bir cevap yazın Cevabı iptal et

E-posta hesabınız yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Şu HTML etiketlerini ve özelliklerini kullanabilirsiniz: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>