I'm trying to figure out the best course of action concerning relational lists. I have create several parent and child related lists but I'm having a bit of trouble understanding how to build my CAML query from both directions. 1. Have Parent - Query for Children 2. Have Child - Query for Parent
I have found very limited examples. Can someone show examples of the following in a CAML structure?
- How to query and return related Child list items using the Parent information.
- How to query and return the Parent using the related Child information.
I realize the CAML query is built of the following, but I really just need help on how to connect it all together from either direction.
using (SPWeb _impWeb1 = _impSite.OpenWeb(_relativeWebUrl)) {
SPList _theList1 = _impWeb1.Lists.TryGetList(_listTitle);
if (_theList != null) {
SPQuery _theQuery = new SPQuery();
_theQuery.Query = "";
_theQuery.Joins = "";
_theQuery.ProjectedFields = "";
_theQuery.ViewFields = "";
SPListItemCollection _theListItems = _theList.GetItems(_theQuery);
if (_theListItems != null) {
// Do Something
}
}
}