我想知道最近3天的雅虎财经新闻,大概是这样的。
select * from rss where url='http://finance.yahoo.com.news/rss' and pubDate >= '2012-06-23'但是这部分"pubDate >= '2012-06-23'“被忽略了。不管有没有这个子句,我总是得到相同的结果。让它工作的正确语法是什么?
发布于 2012-06-25 23:18:34
伊琳娜
您正在对字符串使用‘大于’运算符,
要按pubDate进行过滤,您必须使用以下内容:
and pubDate >= date_trunc('month',current_date)
order by pubdate desc;发布于 2012-06-26 05:23:35
正确的查询应该是
select * from rss where url='http://finance.yahoo.com/news/rss' and item.pubDate>='2012-06-26'请注意item.pubDate。项目的原因。是因为在xml结构中,pubDate是item的子项。
不幸的是,这不适用于您的用例(按时间排序)。这是因为返回的pubDate不在unix时间戳中。对不起,我不知道需要做些什么才能让您获得正确的结果,但至少我可以给您正确的查询:)
https://stackoverflow.com/questions/11191884
复制相似问题