Re: Determining offsets to jump to grab a group of records
От | David Wilson |
---|---|
Тема | Re: Determining offsets to jump to grab a group of records |
Дата | |
Msg-id | e7f9235d0806111529p28e4dd47x706b4ae37858695a@mail.gmail.com обсуждение исходный текст |
Ответ на | Determining offsets to jump to grab a group of records (David Lambert <davidl@dmisoft.com>) |
Ответы |
Re: Determining offsets to jump to grab a group of records
|
Список | pgsql-general |
On Wed, Jun 11, 2008 at 5:54 PM, David Lambert <davidl@dmisoft.com> wrote: > I am trying to find a way to figure out what offset I would have to use in a > SELECT with LIMIT and OFFSET clauses to get a grouping of records. For > example: > > Consider a table full of first names. I want to be able to find the first > offset where the name is "DAVID". (We'll say that it is the 1009th row in > the resulting select) This way I could perform the following: > > SELECT name FROM nametable LIMIT 25 OFFSET 1009; > This isn't an answer to your direct question, but it seems to me as if you've already decided on a solution (figuring out an offset) that's non-optimal. If you're using offsets at all, you must have a distinct sort ordering; if you have that, you should be able to accomplish the same thing with a where clause instead of an offset. Is there a particular reason why this doesn't work for you? Perhaps the better question is "what are you trying to do with this?" There may be a higher level solution that can be given. -- - David T. Wilson david.t.wilson@gmail.com
В списке pgsql-general по дате отправления: