如何在100条记录中选择5至15行? [英] how to select 5 to 15 rows over 100 records?
本文介绍了如何在100条记录中选择5至15行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
如何在100条记录中选择5到15行
hello
how to select 5 to 15 rows over 100 records
推荐答案
您还没有说过要怎么做,我相信您可以通过2种方式实现
1. LINQ
As you haven''t said how you want to do this I believe that you can do it 2 ways
1. LINQ
dim q = (from x in User_object select x).skip(5).take(10)
如何:返回或跳过序列中的元素(LINQ to SQL) [ ^ ]
2. SQL
How to: Return or Skip Elements in a Sequence (LINQ to SQL)[^]
2. SQL
SELECT top 10 * --this takes the first 10 records of the reversed 15 records
FROM (
--This takes the first 15 records and orders them descending by the id_field
SELECT TOP 15 *
FROM table
ORDER BY id_field DESC
)
我对您的数据库结构一无所知,所以我想这个抽象代码会有所帮助.
I have no idea about your database structure, so i guess this abstract code would be helpful.
SELECT TOP (10) *
FROM Table1
WHERE [SomeIDField] NOT IN (
SELECT TOP (5) [SomeIDField]
FROM Table1
)
以下查询给出了您的前15条记录.
following Query gives your first 15 records.
SELECT TOP 15 * FROM Persons
这篇关于如何在100条记录中选择5至15行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文