我正在尝试获取所有未读收件箱的正文和发件人。
为了获取所有带有未读消息的对话线程,我使用了这个查询:
SELECT thread_id from unified_thread WHERE folder='inbox' AND unread=1
为了获取线程的未读消息,我使用了这个查询
SELECT sender,body FROM unified_message WHERE unread=1
我尝试了以下嵌套查询:
SELECT sender,body FROM unified_message WHERE thread_id IN (SELECT thread_id FROM unified_thread WHERE folder = 'inbox' AND unread=1) AND unread=1"
但我只收到一个线程的未读消息,而不是所有未读线程。
我也尝试过这样的多查询:
String query1="SELECT thread_id FROM unified_thread WHERE folder='inbox' AND unread=1";
String query2="SELECT timestamp,sender,body FROM unified_message WHERE unread=1 AND thread_id IN (SELECT thread_id FROM #query1)";
Bundle params = new Bundle();
JSONObject jsonFQL=new JSONObject();
try {
jsonFQL.put("query1",query1);
jsonFQL.put("query2",query2);
} catch (JSONException e) {
e.printStackTrace();
}
params.putString("method","fql.multiquery");
params.putString("queries", jsonFQL.toString());
new Request(session,"/fql",params,HttpMethod.GET,new Request.Callback(){
public void onCompleted(Response response) {
...
}
).executeAsync(); ....
但我得到了错误:
errorMessage:不支持的方法,fql.multiquery
然后我尝试了 INNER JOIN:
SELECT unified_message.sender,unified_message.body
FROM unified_message
INNER JOIN unified_thread
ON unified_message.thread_id=unified_thread.thread_id
WHERE unified_thread.unread=1
但我收到了这个错误:
解析器错误:位置出现意外的“内部”...
我了解到 FQL 不支持 JOIN
有人可以帮我用 FQL 做这个查询吗?
所需输出示例:我与不同的人进行了 5 次对话,但只有 3 次对话有未读消息。所以我想得到这样的东西:
UNREAD MESSAGES
Sender: Anna
Body: hello dude
Body: how are you?
Body: I miss you
Sender: John
Body: please help me
Sender: Erick
Body: nice
Body: buddy