Combining two queries in Yahoo YQL

这一生的挚爱 提交于 2019-12-12 09:41:11

问题


I want to get the weather information for a specific location.

Right now, I need to calls to get them: The first one translated my current position (lat/lon) to a WOEID, the second call retrieves the Weather information by using that WOEID.

Can I combine those 2 queries?

The first one is: select * from yahoo.maps.findLocation where q="LAT, LON" and gflags="R"

The second one is: select * from weather.bylocation where location= WOEID AND unit = 'c'


回答1:


You can use sub-selects to join data between different queries.

In your case, you can grab the woeid from the yahoo.maps.findLocation table and insert that into a query against the weather.bylocation table as follows:

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
)


来源:https://stackoverflow.com/questions/3222803/combining-two-queries-in-yahoo-yql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!