I have a webpart which is 2-3 subsites down the top level site. I need to query the list which is in top site collection and one at the same level,I guess its possible through SPSiteDataquery...I have some confusion related to it can i write single query which can query both these list....
The scope of this query is sitecollection so that means it wud going to look into all list in sitecollection..and if my CAML query is same for both these lists ...it should work?
let me explain through my code:
SPSite mySite = SPControl.GetContextSite(Context);
SPWeb myWeb = SPControl.GetContextWeb(Context);
SPSiteDataQuery qry = new SPSiteDataQuery();
qry.Lists = "<Lists BaseType='0' />";
qry.Query = "<Where><Contains><FieldRef Name='Country'/><Value Type='Text'>" + strcount + "</Value></Contains></Where>";
qry.ViewFields = "<FieldRef Name='Capital' Nullable='TRUE'/><FieldRef Name='Currency' Nullable='TRUE'/>";
qry.Webs = "<Webs Scope='SiteCollection' />";
DataTable dt = myWeb.GetSiteData(qry);
Now i need currency from list which is in top level site and Capital from the list which is at same level. Is this possible? or I misunderstood SPSiteDataQuery...?