SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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

share|improve this answer

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.


share|improve this answer

SharePoint 2010 does support joins in CAML.

SharePoint 2007 does not.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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