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

I'm trying to get the elements with the most new created date using CAML query in sharepoint 2007.

I can do it using:

"<OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy><RowLimit>1</RowLimit>"

To get the most recent date and then use other CAML query to get the elements with that date.

But, theres no other way to do it in one consult?

share|improve this question
What's your issue? You just add a ViewFields node to get the fields you want. – James Love Feb 18 '11 at 16:41

As far as I can tell, you're trying to do the SQL equivalent of a self join: Querying the maximum date in a subquery and joining back to the table on that date.

Unfortunately CAML doesn't allow you to do self joins; I'm afraid there is no way to do this in a single query.

share|improve this answer
Related - You can use SPList.LastModified to get the last time an item was created or modified - but no way to tell if this date was from a creation or update without further checking.… – Ryan Jul 21 '11 at 12:10

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.