Wordpress SQL: Selecting Messages After a Specific Date

You are having problems with dates. What SQL code will I use to receive all messages after 01/01/2011?

AND post_date > XXXX 

Thanks in advance.

+4
source share
3 answers
+5
source
 SELECT * FROM posts WHERE post_date > '2011-01-01' ORDER BY post_date 

something like this should work, or if you want between two dates

 SELECT * FROM posts WHERE post_date BETWEEN '2011-01-01' AND '2011-02-01' ORDER BY post_date 

hope that helps

many good links here http://www.w3schools.com/sql/sql_between.asp

+4
source

In MySQL, it will be:

 SELECT * FROM myTable WHERE post_date='2008-11-11' 

In PostgreSQL, it will be:

 SELECT * FROM myTable WHERE post_date='2008-11-11'::date 
+1
source

All Articles