Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can't sort on friend status because there is no friend status column. You can't do any complex SQL operations joining or unioning the <em>friends</em> table with another table because FQL doesn't support these operations. The best you can do is identify who the friends are via a separate query...</p> <pre><code>SELECT uid FROM friend WHERE uid IN (...ALL USER IDs...) </code></pre> <p>All the <em>uid</em>'s returned from that query will be a subset of your full list, including only those whom are friends.</p> <p><em><strong>Additional Info</em></strong>: </p> <p>The Meetup app is...</p> <ol> <li>First querying it's local database to generate a list of participants. (lets call the result [<code>participants</code>] )</li> <li><p>Then, they perform a query on the facebook <em>friend</em> database to determine which of those [<code>participants</code>] are friends. (lets call the result [<code>participating_friends</code>] )</p> <p><strong>SELECT uid FROM friend WHERE uid IN ([<code>participants</code>])</strong></p></li> <li><p>They also store that list of [<code>participating_friends</code>] uid's in their local database. One column is the user's id (<em>uid</em>) and the other is their friend's uid (<em>friendid</em>).</p></li> <li><p>Finally, to determine <em>friends of friends</em> they query their local friends database (from 3) with a query like:</p> <p><strong>SELECT <em>friendid</em> FROM local_friends WHERE <em>uid</em> IN ([<code>participating_friends</code>])</strong></p></li> </ol> <p><strong>UPDATE</strong>: In retrospect, Meetup might be casting an even wider net as follows:</p> <p>The Meetup app is...</p> <ol> <li>First querying it's local database to generate a list of participants. (lets call the result [<code>participants</code>] )</li> <li><p>Then, they perform a query on the facebook <em>friend</em> database to determine which of those [<code>participants</code>] are friends. (lets call the result [<code>participating_friends</code>] )</p> <p><strong>SELECT uid FROM friend WHERE uid IN ([<code>participants</code>])</strong></p></li> <li><p>Determining <strong>all</strong> friends of the app user who are also app users and store the result in a local database, saving <em>uid</em>'s and associated <em>friendid</em>'s.</p> <p><strong>SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user</strong></p></li> <li><p>Finally, to determine <em>friends of friends</em>, calculate the new set:</p> <p>[<code>participants_not_friends</code>] = [<code>participants</code>] - [<code>participating_friends</code>]. </p> <p>Then query the local friends database (from 3) with a query like:</p> <p><strong>SELECT <em>friendid</em> FROM local_friends WHERE <em>uid</em> IN ([<code>participants_not_friends</code>])</strong></p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload