1

I want to get a user's posts in their wall, and I want to limit the number of records I get. I'm doing so using this query:

SELECT post_id, message, attachment, type, place, updated_time FROM stream WHERE source_id = me() AND actor_id = source_id AND type IN (46, 80, 128, 247) LIMIT 10

So far so good. The problem with this is that if I have a total of, for example 100 posts, and in the first 10 I have 5 that meet the ends of my query, when I put LIMIT 10 I only get those 5 results, because the LIMIT filter is applied on the first query conditions, and not on the total results from that table.

As a temporary workaround I changed my query to this: SELECT post_id, message, attachment, type, place, updated_time FROM stream WHERE post_id IN (SELECT post_id FROM stream WHERE source_id = me() AND actor_id = source_id AND type IN (46, 80, 128, 247) LIMIT 100) LIMIT 10

But this isn't bulletproof, since I am only expanding my possible list of wanted results so I have a higher number to select from.
So, how could I query the wanted results?

Schrödinger's Box
  • 3,038
  • 1
  • 27
  • 50
  • 1
    possible duplicate of [FQL stream doesn't return the number of posts as defined by limit](http://stackoverflow.com/questions/14268907/fql-stream-doesnt-return-the-number-of-posts-as-defined-by-limit) – Fabio Antunes Feb 26 '14 at 10:55
  • also chek this one http://stackoverflow.com/questions/4062085/facebook-fql-stream-limit – Fabio Antunes Feb 26 '14 at 10:56
  • Indeed it answers my question, although it does not solve my problem. It seems as if there is no bulletproof solution to it. – Schrödinger's Box Feb 26 '14 at 11:25

0 Answers0