Having trouble with dates. What SQL code would I use to get all posts after 01.01开发者_运维知识库.2011?
AND post_date > XXXX
Thanks in advance.
AND post_date > "2011-01-01"
http://dev.mysql.com/doc/refman/5.0/en/using-date.html
SELECT * FROM posts
WHERE post_date > '2011-01-01'
ORDER BY post_date
something like that 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
lots of good refrence here http://www.w3schools.com/sql/sql_between.asp
In MySQL it would be:
SELECT * FROM myTable WHERE post_date='2008-11-11'
In PostgreSQL it would be:
SELECT * FROM myTable WHERE post_date='2008-11-11'::date
精彩评论