【问题标题】:Combining two queries in Yahoo YQL在 Yahoo YQL 中组合两个查询
【发布时间】:2011-03-14 11:05:03
【问题描述】:

我想获取特定位置的天气信息。

现在,我需要调用来获取它们:第一个调用将我当前的位置(纬度/经度)转换为 WOEID,第二个调用使用该 WOEID 检索天气信息。

我可以合并这两个查询吗?

第一个是: select * from yahoo.maps.findLocation where q="LAT, LON" and gflags="R"

第二个是: select * from weather.bylocation where location= WOEID AND unit = 'c'

【问题讨论】:

标签: yql yahoo-maps


【解决方案1】:

您可以使用sub-selects 来连接不同查询之间的数据。

在您的情况下,您可以从 yahoo.maps.findLocation 表中获取 woeid 并将其插入到针对 weather.bylocation 表的查询中,如下所示:

select * 
from weather.bylocation 
where unit = 'c' and location in (
    select Results.woeid 
    from yahoo.maps.findLocation
    where q="LAT, LON" and gflags="R"
    limit 1
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-12
    • 1970-01-01
    • 2011-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多