如何将两个FQL查询连接到一个查询中。

时间:2011-12-28 15:01:38

标签: c# wpf fql.multiquery

您好我有两个不同的查询,一个用于username,第二个用于检索Messagesactor_id

所以我如何结合查询和获得正确的结果。 我的查询就像。

var Query1 = fbApp.Query("SELECT uid, name, pic_square FROM user WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())");

var newsFeed = fbApp.Query("SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0");
谢谢.. !!

1 个答案:

答案 0 :(得分:-2)

Enumerable.Union方法允许您组合两个结果(前提是返回相同类型的枚举)。 Enumerable.Intersect可以帮助您仅查找两个列表中都存在的用户。

来自MSDN:

int[] ints1 = { 5, 3, 9, 7, 5, 9, 3, 7 };
int[] ints2 = { 8, 3, 6, 4, 4, 9, 1, 0 };

IEnumerable<int> union = ints1.Union(ints2);

foreach (int num in union)
{
     Console.Write("{0} ", num);
}
/*
This code produces the following output:

5 3 9 7 8 6 4 1 0
*/

所以对你这样的事情:

var combinedList = Query1.Union(newsFeed);