How I can join two FQL queries into one query.?

349 views Asked by At

Hi I have Two Different Queries one is for username and second is for retrieving Messages and actor_id

so how I can combine both query and getting my correct result. my queries like.

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");

thank you..!!

1

There are 1 answers

3
Arbiter On

The Enumerable.Union method allows you to combine both results (provided both return an enumeration of the same type). Enumerable.Intersect can help you find only users that exist in both lists.

From 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
*/

So for you something like this:

var combinedList = Query1.Union(newsFeed);