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?
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).