我想只从fb中获取指定生日的记录,我不想要空记录。我有以下查询:
String fqlQuery = "{" +
"'friends':'SELECT uid2 FROM friend WHERE uid1 = me()'," +
"'friendinfo':'SELECT uid, name, pic_square, birthday FROM user WHERE uid IN" +
"(SELECT uid2 FROM #friends)'," +
"}";
它取出了所有内容,我尝试了以下内容:
String fqlQuery = "{" +
"'friends':'SELECT uid2 FROM friend WHERE uid1 = me()'," +
"'friendinfo':'SELECT uid, name, pic_square, birthday FROM user WHERE uid IN" +
"(SELECT uid2 FROM #friends)'," + "AND birthday != null"+
"}";
它没有给我任何结果,这样做的正确方法是什么?
答案 0 :(得分:2)
在FQL中,只需使用AND something
检查something
是否为空。
以下是您更正的FQL查询:
{
'friends':'SELECT uid2 FROM friend WHERE uid1 = me()',
'friendinfo':'SELECT uid, name, pic_square, birthday FROM user
WHERE uid IN(SELECT uid2 FROM #friends)
AND birthday'
}
Java代码:
String fqlQuery = "{" +
"'friends':'SELECT uid2 FROM friend WHERE uid1 = me()'," +
"'friendinfo':'SELECT uid, name, pic_square, birthday FROM user WHERE uid IN" +
"(SELECT uid2 FROM #friends) AND birthday'"+
"}";