문제

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'

도움이 되었습니까?

해결책

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
)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top