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

How do I create a CAML query to display all items on the list order by ItemChildCount?

Somewhat like this:

 Select * 
 from table 
 order by itemChildCount descending 
share|improve this question
up vote 2 down vote accepted

I believe the OrderBy Element is what you're looking for:

SPQuery query = new SPQuery();
query.Query = "<OrderBy><FieldRef Name='ItemChildCount' Ascending='FALSE' /></OrderBy>"; 

Adapted from the example here: SPQuery.ViewFields

Additionally, this is a useful CAML Query reference: Query Schema

share|improve this answer
    
Still have problem on the query. I created another question sharepoint.stackexchange.com/questions/15312/… – Carls Jr. Jun 28 '11 at 11:03

Tools like Strammit or U2U can help you build any CAML you desire.

share|improve this answer

Your Answer

 
discard

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.