Re: [sqlite] any way to SELECT the 100th-104th row of a table?

2007-10-07 Thread Peter Bierman

At 3:00 PM -0700 10/7/07, Adam Megacz wrote:

Hello.  This is probably a stupid question, but...

Is there any way to include some phrase in a SELECT clause that will
match only the Nth-Mth rows of a table, for some values of N and M?

Note that ROWID isn't what I'm looking for -- if you delete rows from
a table the ROWID no longer matches the "row number".



SELECT * FROM table LIMIT 120 OFFSET 100;

http://sqlite.org/lang_select.html

"The LIMIT clause places an upper bound on the number of rows 
returned in the result. A negative LIMIT indicates no upper bound. 
The optional OFFSET following LIMIT specifies how many rows to skip 
at the beginning of the result set. In a compound query, the LIMIT 
clause may only appear on the final SELECT statement. The limit is 
applied to the entire query not to the individual SELECT statement to 
which it is attached."


-pmb

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] any way to SELECT the 100th-104th row of a table?

2007-10-07 Thread miguel manese
select * from table limit (n-1),(m-n)

n-1 because it is 0-based

http://www.sqlite.org/lang_select.html

On 10/8/07, Adam Megacz <[EMAIL PROTECTED]> wrote:
>
> Hello.  This is probably a stupid question, but...
>
> Is there any way to include some phrase in a SELECT clause that will
> match only the Nth-Mth rows of a table, for some values of N and M?
>
> Note that ROWID isn't what I'm looking for -- if you delete rows from
> a table the ROWID no longer matches the "row number".
>
> Thanks,
>
>   - a
>
> --
> PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] any way to SELECT the 100th-104th row of a table?

2007-10-07 Thread Cory Nelson
"LIMIT 4 OFFSET 100" at the end of the select.

On 10/7/07, Adam Megacz <[EMAIL PROTECTED]> wrote:
>
> Hello.  This is probably a stupid question, but...
>
> Is there any way to include some phrase in a SELECT clause that will
> match only the Nth-Mth rows of a table, for some values of N and M?
>
> Note that ROWID isn't what I'm looking for -- if you delete rows from
> a table the ROWID no longer matches the "row number".
>
> Thanks,
>
>   - a
>
> --
> PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>


-- 
Cory Nelson
http://www.int64.org

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] any way to SELECT the 100th-104th row of a table?

2007-10-07 Thread Vitali Lovich
The only way I can think of doing it without modifying the table (i.e. 
adding a rowid column that's updated on every delete) is to select all 
the rows on the table

and then increment count for every step that returns a row.

Adam Megacz wrote:

Hello.  This is probably a stupid question, but...

Is there any way to include some phrase in a SELECT clause that will
match only the Nth-Mth rows of a table, for some values of N and M?

Note that ROWID isn't what I'm looking for -- if you delete rows from
a table the ROWID no longer matches the "row number".

Thanks,

  - a

  


-
To unsubscribe, send email to [EMAIL PROTECTED]
-