Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
How do I create a CAML query to display all items on the list order by ItemChildCount?
Somewhat like this:
order by itemChildCount descending
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
Tools like Strammit or U2U can help you build any CAML you desire.
Required, but never shown