Reputation: 427
I am trying to get the last 10 posts from a user's stream. For some reason my FQL query will return two of every post in succession. Here is my code, Pardon the CoffeeScript,
method = 'fql.multiquery'
queries = 'feed' : "SELECT attachment , type , created_time , filter_key, actor_id, description, message FROM stream WHERE (filter_key = 'others' OR filter_key = 'owner') ORDER BY created_time DESC LIMIT 10"
params =
method : method
queries : queries
FB.api (params) , (response) =>
#and so on
I am not really sure why this is happening.
Upvotes: 1
Views: 559
Reputation: 2492
FQL can't do group by's, and Facebook stores post stories in various ways, so there are "multiples". The way to get around this is to select the columns you need, and do a "where in" to limit your result set, i.e.:
select
attachment , type , created_time , filter_key, actor_id, description, message
FROM
stream
WHERE
post_id in (select post_id
FROM
stream
WHERE
(filter_key = 'others' OR filter_key = 'owner' and created_time < [long-ass unix time])
)
Upvotes: 2