.
> I can't do it by ID because what if a row in the middle somewhere gets
> deleted? I need to do it by the position in the table, and a static
> numbering column won't work. This is a solution someone on EFNet came up
> with:
>
> SET @rowcount=0;
> select docid,@rowcount:=@rowcount+1 as num
.
> I can't do it by ID because what if a row in the middle somewhere gets
> deleted? I need to do it by the position in the table, and a static
> numbering column won't work. This is a solution someone on EFNet came up
> with:
>
> SET @rowcount=0;
> select docid,@rowcount:=@rowcount+1 as num
rows in set (0.00 sec)
-Original Message-
From: Benjamin Pflugmann [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 22, 2002 10:41 AM
To: SpamSucks86
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Return every Nth row in a result set
Hello.
On Sun 2002-12-22 at 08:56:43 -0500,
Hello.
On Sun 2002-12-22 at 08:56:43 -0500, [EMAIL PROTECTED] wrote:
> I really don't want to do this client side (I'd have to execute
> approximately 10 queries for every page load just for this small task).
> Selecting the entire table into a temp table to number the rows also
> seems rather ine
I really don't want to do this client side (I'd have to execute
approximately 10 queries for every page load just for this small task).
Selecting the entire table into a temp table to number the rows also
seems rather inefficient. I was reading in a book at Barnes and Noble
yesterday which said to
t;[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 22, 2002 4:37 AM
Subject: Return every Nth row in a result set
> What would be the SQL query to return every Nth row in a result set? So
> it would return the 5th row, the 10th row, the 15th row, etc.
ount == 0||$count % 5 == 0){
print FILEHANDLE "my item is $ref->[0],$ref->[1]...etc\n";
} continue { $count++; $total--;}
Jim
-Original Message-
From: SpamSucks86 [mailto:[EMAIL PROTECTED]]
Sent: Saturday, December 21, 2002 8:38 PM
To: [EMAIL PROTECTED]
Subject: Return every Nth ro
What would be the SQL query to return every Nth row in a result set? So
it would return the 5th row, the 10th row, the 15th row, etc. Thanks for
any and all replies!