FQL语句获取两个人的照片(查询不可索引错误)
SELECT pid FROM photo WHERE me() and $otherPerson IN ( SELECT subject FROM photo_tag WHERE pid=pid ) ORDER BY created DESC LIMIT 1
我正在尝试获取一张包含两个用户标签的照片($otherPerson 被替换为用户 ID)。此查询返回:
604 Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://wiki.developers.facebook.com/index.php/FQL_Tables
关于如何完成这项工作有什么想法吗?
更新:
我目前正在使用此查询,但我觉得好像有更好的方法可以进行。
SELECT pid, src_big FROM photo
WHERE pid IN (
SELECT pid FROM photo_tag
WHERE subject=$otherGuy
AND pid in (
SELECT pid FROM photo_tag WHERE subject=me()
)
)
SELECT pid FROM photo WHERE me() and $otherPerson IN ( SELECT subject FROM photo_tag WHERE pid=pid ) ORDER BY created DESC LIMIT 1
I'm trying to get a photo that has both users tagged in it ($otherPerson is replaced with a user id). This query returns:
604 Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://wiki.developers.facebook.com/index.php/FQL_Tables
Any ideas on how I can make this work?
UPDATE:
I currently have this query working but I feel as though there's a better way to go about.
SELECT pid, src_big FROM photo
WHERE pid IN (
SELECT pid FROM photo_tag
WHERE subject=$otherGuy
AND pid in (
SELECT pid FROM photo_tag WHERE subject=me()
)
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这应该可以解决问题。
This should do the trick.
怎么样:
另外,
pid=pid
是什么意思?What about:
Also, what
pid=pid
means?我尝试了其他解决方案并遇到了问题 - 如果您的朋友将其隐私设置设置为禁止应用程序访问他的照片,则以下 FQL 查询将返回一个空表:
我通过使用以下多重查询解决了此问题:
I tried the other solutions and ran into a problem - If your friend has set his privacy settings to disallow apps from accessing his photos, then the following FQL query will return an empty table:
I solved this by using the following multiquery instead: