FQL语句获取两个人的照片(查询不可索引错误)

发布于 2024-10-04 16:30:42 字数 831 浏览 1 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

仅此而已 2024-10-11 16:30:42

这应该可以解决问题。

SELECT pid, src_big
FROM photo
WHERE pid IN(
    SELECT pid  
    FROM photo_tag
    WHERE subject = me()
) 
AND pid IN(
    SELECT pid  
    FROM photo_tag
    WHERE subject = <friend_user_id>
)

This should do the trick.

SELECT pid, src_big
FROM photo
WHERE pid IN(
    SELECT pid  
    FROM photo_tag
    WHERE subject = me()
) 
AND pid IN(
    SELECT pid  
    FROM photo_tag
    WHERE subject = <friend_user_id>
)
别挽留 2024-10-11 16:30:42

怎么样:

  SELECT pid
    FROM photo
   WHERE me() IN (SELECT subject
                    FROM photo_tag
                   WHERE pid=pid)
     AND $otherPerson IN (SELECT subject
                            FROM photo_tag
                           WHERE pid=pid)
ORDER BY created DESC
   LIMIT 1

另外,pid=pid 是什么意思?

What about:

  SELECT pid
    FROM photo
   WHERE me() IN (SELECT subject
                    FROM photo_tag
                   WHERE pid=pid)
     AND $otherPerson IN (SELECT subject
                            FROM photo_tag
                           WHERE pid=pid)
ORDER BY created DESC
   LIMIT 1

Also, what pid=pid means?

小清晰的声音 2024-10-11 16:30:42

我尝试了其他解决方案并遇到了问题 - 如果您的朋友将其隐私设置设置为禁止应用程序访问他的照片,则以下 FQL 查询将返回一个空表:

"SELECT pid FROM photo_tag WHERE subject = <friend_user_id>"

我通过使用以下多重查询解决了此问题:

"query1" : "SELECT subject, pid FROM photo_tag WHERE pid IN (SELECT pid FROM photo_tag WHERE subject=me())"
"query2" : "SELECT pid FROM #query1 WHERE subject= <friend_user_id>"

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:

"SELECT pid FROM photo_tag WHERE subject = <friend_user_id>"

I solved this by using the following multiquery instead:

"query1" : "SELECT subject, pid FROM photo_tag WHERE pid IN (SELECT pid FROM photo_tag WHERE subject=me())"
"query2" : "SELECT pid FROM #query1 WHERE subject= <friend_user_id>"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文