Skip to content

Instantly share code, notes, and snippets.

@mrbongiolo
Last active June 22, 2016 19:44
Show Gist options
  • Save mrbongiolo/1065199 to your computer and use it in GitHub Desktop.
Save mrbongiolo/1065199 to your computer and use it in GitHub Desktop.
Query for FQL to get all photos from a Facebook Page albums and all photos tagged with that Facebook Page
# Formatted for readability
SELECT src, src_height, src_width, src_small, src_small_height, src_small_width
FROM photo
WHERE pid IN (SELECT pid
FROM photo_tag
WHERE subject='243117879034102' )
OR
pid IN (SELECT pid
FROM photo
WHERE aid IN (SELECT aid
FROM album
WHERE owner='243117879034102' AND type!='profile' )
)
# One line query
SELECT src, src_height, src_width, src_small, src_small_height, src_small_width FROM photo WHERE pid IN (SELECT pid FROM photo_tag WHERE subject='243117879034102') OR pid IN (SELECT pid FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner='243117879034102' AND type!='profile'))
@brianfryer
Copy link

@mrbongiolo: You. Are. My. Hero.

@pablodesogos
Copy link

Thanks a lot!!!!

@PcNy
Copy link

PcNy commented Feb 7, 2014

Thank alot!

@mautematico
Copy link

¡Gracias!

@mrbongiolo do you have a Facebook Graph version of this, or do you know how to do offset/pagination with success?

Things like
Limit 401,800 won't work. For some reason, this fql is always limited to 400 results. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment