0

Flickr Join

hi,
is there a way to join these two queries into one?

select * from flickr.photos.sizes where photo_id = '2186714153'
select * from flickr.photos.info where photo_id='2186714153'

thanks

Lukas

by
1 Reply
  • You can use the query.multi table, e.g:
    CODE
    select * from query.multi where query = "select * from flickr.photos.sizes where photo_id = '2186714153'; select * from flickr.photos.info where photo_id='2186714153'"


    If you are doing Flickr searches to you can also use the in keyword. E.g:

    CODE
    select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where text="kittens");


    That way you can get the info for every Flickr photo in the search. It's slightly counter-intuitive but you can also double-down on the query.multi too.

    CODE
    select * from query.multi where query = "select * from flickr.photos.sizes where photo_id in (select id from flickr.photos.search where text='kittens'); select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where text='kittens');"


    The first time
    CODE
    select id from flickr.photos.search where text='kittens'
    is called YQL caches the calls so the second time it's called it's really fast because the results are coming from YQL's local cache. So while you use the same query twice, it doesn't take anywhere near twice as long.
    0

Recent Posts

in YQL