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

I want to write an equivalent CAML query for the given SQL Query below:

select top 10 * from TestTable where ItemID in ( select top 10 ItemID from TestTable order by Views desc) order by UserName desc;

How do I do this?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Check out U2U CAML Query Builder, it'll help you build any number of CAML Query possibilities that you need.

http://www.u2u.net/res/Tools/CamlQueryBuilder.aspx

share|improve this answer
    
But I do not see any option to get the top 10 items... –  Karthikeyan Dec 21 '10 at 14:42
    
You need to use the RowLimit tag. –  James Love Dec 21 '10 at 15:04
    
Sorry, I am not able to make such a CAML query, any help –  Karthikeyan Dec 21 '10 at 16:57
    
Just bang a <RowLimit>10<RowLimit> in your query somewhere inside <View></View> –  James Love Dec 21 '10 at 17:40
    
i agree, rowcount works perfectly however it does not to make a sub query ... –  Karthikeyan Dec 21 '10 at 20:16
show 2 more comments

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.