In SharePoint 2007, if I had 2 lists with a master/detail type relationship (via a lookup column) how would I best implement a search query across these 2 lists (for a custom search and results page). For example a Project list and a Task list where you might want to search by Project ID, Name, Owner and Task Dates. The results would display all matching Project/Tasks in a paged grid. Is it possible to do this in CAML (I believe the answer is no!) or do we need to run separate queries against both lists and then match them up in C# somehow. There must be some proven methods for this sort of thing?

As always any help much appreciated. James.

3 Answers 3


You could also create a filter web part that connects to your standard list view web part. This can then be used to filter the view based on the selection in the filter web part. You can also code your own filter web parts.

This is also possible using BDC with a list web part and a filter web part.

AFAIK you cannot do joins with CAML.

Some links about filter web parts: OOBT: Working with filter web parts MSDN: Filter Web Parts Overview Visual How-To: Writing a filter provider web part

hth Anders Rask


I would probably build this functionality with a Data View Web Part (DVWP). You have lots of control over the formatting, can generate data-driven controls, etc.

You can't build the join in the CAML, but you can build analogous functionality in the DVWP or in C#, which sounds like it would be your preference.



SharePoint 2010 does support joins in CAML.

SharePoint 2007 does not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.