0

以下のようなテーブルから5限界5から始まる次の5つのレコードをフェッチするようにmysqlに指示するSQLを作成するにはどうすればよいですか?

srt_id (this is not the auto increment column even though the value is incremented)
------
  1
  2
  3
  4
  5
  6
  7
  8 
  9
 10

ここでは、6で開始し、10で終了したいと思います。6、7、または8で開始したい場合もあります。オフセット5などは使用できません。その行から始めて、残りをフェッチする必要があります。u plsは役に立ちますか?

だから、私は試しました:

select * from table where srt_id = 5 limit 5; //Begin at 5 and the next 5 records
4

1 に答える 1

1
select * from table where srt_id >= 5 order by srt_id limit 5;
于 2012-11-12T16:29:23.150 に答える