日期有问题。在01.01.2011之后我会用什么SQL代码来获取所有帖子?
AND post_date > XXXX
提前致谢。
答案 0 :(得分:7)
AND post_date > "2011-01-01"
答案 1 :(得分:4)
SELECT * FROM posts
WHERE post_date > '2011-01-01'
ORDER BY post_date
类似的东西应该有用,或者如果你想要两个日期之间
SELECT * FROM posts
WHERE post_date BETWEEN '2011-01-01' AND '2011-02-01'
ORDER BY post_date
希望有所帮助
答案 2 :(得分:1)
在MySQL中它将是:
SELECT * FROM myTable WHERE post_date='2008-11-11'
在PostgreSQL中它将是:
SELECT * FROM myTable WHERE post_date='2008-11-11'::date