I have a list where IDs are not unique.

How can I make a CAML Query for this list so I can get all values for a particular ID This is my list:

 ID        Customer     LOB    PeriodOne  PeriodTwo   PeriodThree   
100003        SSD       GH      1521         215            855
100003        SSD       GF      7481         0               25
100003        SSD       TD      5498         325            241
100203        XDC       GH      2521         415            455
100203        XDC       GF      7481         12              55
100203        XDC       TD      588          125            231


2 Answers 2


user7400's answer will query based on the built in SharePoint unique ID field, which this ID field is clearly not. You first need to determine the Internal Name of the ID field in your list - the tools mentioned can help, or, you can look at the query string of the Edit column page from list settings (noting that _ gets encoded as %5F). I think it's most likely ID_0.

The query would then be more like:

     <FieldRef Name='ID_0' />
     <Value Type='Number'>100003</Value>

(Assuming the field is a number and not text; if it is text, set Type="Text" instead)


This should give you a result set filtered by your particular ID

     <FieldRef Name='ID' />
     <Value Type='Counter'>100003</Value>

And you want to get yourself the CAML Query Builder (Download the 2007 version) or Designer. It'll save you a ton of time and effort!

Your Answer

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

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