1

I want to get all the checkins a user is tagged in (note: I am not interested in his own checkins). I tried the following, which is a little illogical and of course does not work, but you'll get what I am trying to do:

SELECT message FROM checkin WHERE tagged_uids IN 
(SELECT uid FROM user WHERE uid = me())

Any ideas?

Nicolai Dahl
  • 259
  • 3
  • 9

1 Answers1

4

You're thinking of IN backwards. The query you're looking for is:

SELECT message FROM checkin WHERE me() IN tagged_uids

However, tagged_uids is not indexable, so you'll need to know more information before you can run this query (like who is actually recording the checkin). One thing you could try is:

SELECT message FROM checkin 
WHERE author_uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) 
    AND me() IN tagged_uids

This will find all checkins in which your user is tagged that are by friends of the user (probably the only people who can check in that user anyway).

Jimmy Sawczuk
  • 13,488
  • 7
  • 46
  • 60
  • 1
    `tagged_uids` [is an array](http://developers.facebook.com/docs/reference/fql/checkin/), and you don't need to use a column name, any value will do. So yes, you can use `IN`. You can certainly query the `tagged_uids` column, but you can't query it *exclusively* - that's what's meant by a field being indexable. Since I have another indexable field in my `WHERE`, that query is valid. – Jimmy Sawczuk Jul 28 '11 at 16:43
  • 1
    A small note to future readers. This only works when using me(), as I do not have permission to look through my friends' friends – Nicolai Dahl Jul 28 '11 at 18:34