Random Friend using FQL

不羁岁月 提交于 2020-01-02 10:26:25

问题


I am right now using fql which brings all the friend list in array. Then I sort that array to get a random friend.

But it seems to take long time since i have to collect all the friends to get single random friend.

How do i go this in fql to get random friend?

SELECT uid, name, pic, sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())

回答1:


SELECT uid, name, pic, sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) order by rand() limit 1



来源:https://stackoverflow.com/questions/11465976/random-friend-using-fql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!