Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select n records from nth record in linq

I am searching for something like LIMIT(10, 10) <- thats how it works in php

Products = Products.Take(10).ToList();

That's not what i want because I want to skip first 10 records .

does anybody know how i can do this?

like image 584
Bernardmoes Avatar asked Apr 11 '13 12:04

Bernardmoes


People also ask

How do I select every nth record in a table?

Search on Esri Community Submit to ArcGIS Ideas To select every nth record in a table using Select by Attributes and, use the modulo function (MOD). This avoids the use of Python scripting and can be input to the Feature Class to Feature Class tool. Extra modifications can be made to start at a particular record, as well.

How to get top record from a LINQ query?

In above LINQ query same as sql need to apply the where condition first than make collection reverse using order by function and to get top record you just need to make user of Take function. This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

How to select every nth record in a table using modulo?

Search on Esri Community Submit to ArcGIS Ideas To select every nth record in a table using Select by Attributes and, use the modulo function (MOD). This avoids the use of Python scripting and can be input to the Feature Class to Feature Class tool. Extra modifications can be made to start at a particular record, as well. Use the following formula:

How to get last N number of records from table in T-SQL?

To get last n number of record (s) from table I do write the following query on my table records in T-SQL. As you see in above query important thing is using order by with desc keyword means reversing the table records - (mostly we apply the order by desc on the primary key of the table).


2 Answers

Use Skip

Products = Products.Skip(10).Take(10).ToList();
like image 123
Mehmet Ataş Avatar answered Oct 20 '22 04:10

Mehmet Ataş


try this:

 Products = Products.Skip(10).Take(10).ToList();
like image 26
KF2 Avatar answered Oct 20 '22 05:10

KF2