Get events created by friends (but returning their names too)

44 views Asked by At

I can get events created by my friends:

SELECT eid, name, start_time, pic_cover.source, location, venue FROM event 
WHERE creator IN (SELECT uid2 FROM friend WHERE uid1=me())

But I want to get my friends names asociated to that events. How can I think of that?

1

There are 1 answers

2
Tobi On

As FQL doesn't support joins between tables, the only solution I can think of is that you match the names of your friends and the events they created in your application.

Therefore, you'd need to issue two separate statements:

SELECT uid, first_name, last_name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())

and

SELECT eid, creator, name, start_time, pic_cover.source, location, venue FROM event WHERE creator IN (SELECT uid2 FROM friend WHERE uid1=me())

and then match them via uid (from the first query) and creator (from the second query).