Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:53:14+00:00 2026-06-15T12:53:14+00:00

From the below FQL query I’m able to get the actor_id and attachment data

  • 0

From the below FQL query I’m able to get the actor_id and attachment data for a post that is on my newsfeed and contains ‘www.youtube.com’. However, I’d like to be able to also get that user’s picture and name. How would I incorporate this into the below query?

SELECT created_time, post_id, actor_id, type, updated_time, attachment
FROM stream 
WHERE post_id IN 
   (SELECT post_id
    FROM stream
    WHERE ('video') IN attachment 
    AND source_id IN
       (SELECT uid2
        FROM friend
        WHERE uid1=me())
    LIMIT 100)

Edit:

    #right fql query, but prints only part of it
    posts_query = "SELECT created_time, post_id, actor_id, type, updated_time, attachment FROM stream WHERE post_id in (select post_id from stream where ('video') in attachment AND source_id IN ( SELECT uid2 FROM friend WHERE uid1=me()) limit 100)"
    fql_var = "https://api.facebook.com/method/fql.query?access_token=" + token['access_token'] + "&query=" + posts_query + "&format=json"
    data = urllib.urlopen(fql_var)
    fb_stream = json.loads(data.read())
    #print ast.literal_eval(json.dumps(fb_stream))

    users_query = "SELECT uid, first_name FROM user WHERE uid IN (SELECT actor_id FROM (" + posts_query+"))"
    fqlquery_user = "https://api.facebook.com/method/fql.query?access_token=" + token['access_token'] + "&query=" + users_query + "&format=json"
    user_data2 = urllib.urlopen(fqlquery_user)
    user_stream2 = json.loads(user_data2.read())
    print ast.literal_eval(json.dumps(user_stream2))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:53:14+00:00Added an answer on June 15, 2026 at 12:53 pm

    It seems you can’t do it with only one query, because:

    1. You can only SELECT from one table at once in FQL.
    2. There are no JOINs in FQL. (See this question and that one)

    If you could, this is how it would look like:

    SELECT created_time, post_id, actor_id, type, updated_time, attachment, user.first_name
    FROM stream
    WHERE ('video') in attachment AND 
            source_id IN (SELECT uid2 FROM friend WHERE uid1=me())
    LEFT JOIN user ON user.uid=actor_id
    LIMIT 100
    

    But there are no joins, so you need to use what Facebook calls a multiquery, and you would have two queries:

    posts_query =
    SELECT created_time, post_id, actor_id, type, updated_time, attachment
    FROM stream
    WHERE ('video') in attachment AND 
            source_id IN (SELECT uid2 FROM friend WHERE uid1=me())
    LIMIT 100
    
    users_query =
    SELECT uid, first_name
    FROM user
    WHERE uid IN (SELECT actor_id FROM #posts_query)
    

    Here is a link to the Explorer for you to test it.

    Note: There is something useless you are doing in your original query, which is selecting from a table, and adding a subquery in the where clause from that same table. So that’s redundant.

    Update:

    #right fql query, but prints only part of it
    posts_query = "SELECT created_time, post_id, actor_id, type, updated_time, attachment FROM stream WHERE post_id in (select post_id from stream where ('video') in attachment AND source_id IN ( SELECT uid2 FROM friend WHERE uid1=me()) limit 100)"
    users_query = "SELECT uid, first_name FROM user WHERE uid IN (SELECT actor_id FROM (#posts_query))"
    
    queries = {'posts_query': posts_query, 'users_query': users_query}
    fql_var = "https://api.facebook.com/method/fql.query?access_token=" + token['access_token'] + "&q=" + json.dumps(queries_json) + "&format=json"
    data = urllib.urlopen(fql_var)
    fb_stream = json.loads(data.read())
    print ast.literal_eval(json.dumps(fb_stream))
    

    The idea is to send both queries with their names as keys, encode in JSON, so that Facebook understands that #posts_query is the one you sent in that same API request. You to send the name exactly as you send it in the JSON encoded object literally, not replace it by the query itself. Check the docs on multiquery for details and examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not able to call take method from below linq query var data =
From below HTML code I want to get all the text except that in
from below code i am able to get the MMS but the date is
I want to get filter column string from below Data. URL PreFix OutPut ConcatStrings
How to get private key in string from below... key = paramiko.RSAKey.generate(1024) ssh_key =
I am able to provide animation to an image button from below code. this.RegisterName(image1.Name,
I want to get the content of a list in a webpage from below
I am wondering how to get the Json value ?(from below JSOn I would
How can I return List<personel> data type from below procedure. If I press F5
i have data below from streaming: 'ID|20120206|080500|0000001|0|1|record1|END' 'ID|20120206|080500|0000002|0|1|record2|END' 'ID|20120206|080500|0000003|0|1|record3|END' and i want to process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.