1

To get last 10 comments for each post I do:

select * from (
select *,Row_Number() orver(partition by postId order by id desc) RowNum
) where RowNum <= 10

Now how do I do exact same thing with Linq method chaining?

Edit: The above code is an example, What I exactly want to know is that how partitioning is done with linq.

Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171
  • 1
    Do you have a specific problem about linq or just simply want someone to write it for you? – EZI Jul 07 '15 at 00:12
  • I guess you don't read comments... – EZI Jul 07 '15 at 00:13
  • well actually I have a problem partitioning I want to know how it is done I just gave this as a sample that you could understand exactly what I mean and I better understand the answer. – Ashkan Mobayen Khiabani Jul 07 '15 at 00:14
  • OK, show what you have tried... Otherwise I read it as: *translate this sql to linq for me* which is off topic for SO. – EZI Jul 07 '15 at 00:15
  • I don't want a translation, I just want a simple example of partitioning. as I said this was an example just to show you what I mean exactly – Ashkan Mobayen Khiabani Jul 07 '15 at 00:17
  • OK I got it. Every lazy programmer says the same without posting any code showing his effort about the question. – EZI Jul 07 '15 at 00:18
  • 3
    @EZI you are seriously everything that's wrong with StackOverflow. The guy wants some help doing something he doesn't understand. Instead of being overbearing about it, why don't you help? – C Bauer Jul 07 '15 at 00:23

0 Answers0