1

这是我要找的东西:

选择 author_uid, tagged_uids, page_id from location_post where author_uid = me() 或 ( author_uid in (select uid2 from friend where uid1=me()) and me() in tagged_uids)

当我拆分查询时,它们会返回预期的结果。

即,两者

  1. 从 location_post 中选择 author_uid、tagged_uids、page_id where author_uid = me()
  2. select author_uid, tagged_uids, page_id from location_post where author_uid in (select uid2 from friend where uid1=me()) and me() in tagged_uids

按预期工作。我需要的是 2 的联合。我很想说这是 API 中的错误(或限制)

笔记:

  1. 如果硬编码我朋友的 id 和我的 id 之一,OR 子句本身就有效。即author_uid=<my-id> 或 (author_uid=<frnd-id> and <my-id> in tagged_uids)
4

2 回答 2

2

问题是查询中的 me() 。我有用户的 ID 并用实际 ID 替换 me() 完成了这项工作

SELECT id, author_uid, page_id, tagged_uids, timestamp, coords FROM location_post WHERE (&lt;id> IN tagged_uids or author_uid = &lt;id>)
于 2012-08-31T08:47:34.587 回答
0


你试图做的事情不会奏效。您可以尝试运行多查询并立即取回结果并最终比较它们。

于 2012-08-28T21:42:55.773 回答