1

我想获得最近 3 天的雅虎财经新闻,类似的

select * from rss where url='http://finance.yahoo.com.news/rss' and pubDate >= '2012-06-23'

但是这部分“pubDate >= '2012-06-23'”被忽略了。不管有没有这个子句,我总是得到相同的结果。使它工作的正确语法是什么?

4

2 回答 2

0

正确的查询是

select * from rss where url='http://finance.yahoo.com/news/rss' and item.pubDate>='2012-06-26'

注意 item.pubDate。项的原因。是因为在 xml 结构中,pubDate 是 item 的子项。

不幸的是,这不适用于您的用例(按时间排序)。那是因为返回的 pubDate 不在 unix 时间戳中。抱歉,我不知道需要做什么才能让您获得正确的结果,但至少我可以给您正确的查询 :)

于 2012-06-25T21:23:35.463 回答
0

伊琳娜,
你在字符串上使用“大于”运算符,
要按 pubDate 过滤,你必须使用类似的东西,

and pubDate >= date_trunc('month',current_date)
order by pubdate desc;
于 2012-06-25T15:18:33.523 回答