Search code examples
facebookfacebook-fql

Facebook (FQL) - How can I sort wall posts by Most Recent and/or Top stories


I am using FQL and now I have the following fql queries:

First one: query get's all my wall posts that shared by my friends (it's working fine):


SELECT type, source_id, share_count, permalink, description, post_id, actor_id, target_id, message  
FROM stream 
WHERE source_id in (SELECT uid1 FROM friend WHERE uid2=me())

Second one: query get's all my wall posts that shared by my liked pages (it's working fine):


SELECT type, source_id, share_count, permalink, description, post_id, actor_id, target_id, message 
FROM stream
WHERE filter_key = 'others'

and now every thing is okay,

so my question is

"Is there any way to sort that posts by [Most Recent or Top stories] either by FQL or Graph API?"

Thank you so much in advanced.


Solution

  • These is how I would do the most recent

    SELECT 
        type, source_id, share_count, permalink, description, 
        post_id, actor_id, target_id, message, created_time
    FROM 
        stream 
    WHERE 
        source_id in (SELECT uid1 FROM friend WHERE uid2=me())
    ORDER BY
        created_time desc
    
    SELECT 
        type, source_id, share_count, permalink, description, 
        post_id, actor_id, target_id, message, created_time
    FROM 
        stream
    WHERE 
        filter_key = 'others'
    ORDER BY
        created_time desc
    

    but regarding top stories I don't think there is a way to do it, but you most likely have to develop your own criteria for the posts you want to see as top and make a query based on that, you may find this page useful in your quest