I have a following problem in c# SDK: when I try to run multiquery in my desktop application with following string (searching for pairs of IDs of mutual friends) I get a parser error:
string strCommonFriendsQuery = "{
\"user_friends\":\"SELECT uid2 FROM friend WHERE uid1 = me()\",
\"mutual_friends\":\"SELECT uid1, uid2 FROM friend WHERE uid1 IN (SELECT uid2 FROM #user_friends) AND uid2 IN (SELECT uid2 FROM #user_friends)\"
}";
fb.Query(strCommonFriendsQuery);
Parser error: unexpected '{' at position 0.
The same string (without the escape sequences before quotation marks) works if I paste it to http://developers.facebook.com/docs/reference/rest/fql.multiquery/ but not in http://developers.facebook.com/docs/reference/rest/fql.query/ so the problem is that I need to launch it as multiquery and not as a query - now what I would like to ask is:
Is it possible to somehow process multi-query using the Facebook.FacebookClient.Query function of the SDK or do I have to write a function which would do that? As I understand the only thing I would need to change is the address to which it connects to. If so, could it be added in the next SDK version?
To do a multiquery with a reference to the first query, such as the one in the question, do as follows:
To answer this, I got inspired from here (had to figure out that queries start from 0): How to use fql.multiquery with C# SDK
Enjoy!
Here is an alternate to firepol's answer, with named queries: