Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

2 Answers 2

up vote 1 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
add comment

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

share|improve this answer
add comment

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.