Selecting every 50th row

From: Date: Wed, 03 Dec 2003 05:43:10 +0000
Subject: Selecting every 50th row
Groups: php.db 
Request: Send a blank email to php-db+get-31862@lists.php.net to get a copy of this message
Hi php-db, I have a table with approx. 250,000 rows in it. The primary key is an ID field. All I am wondering is - is there any way at all from MySQL to directly select every 50th row in this table? I.e. row 1, 50, 100, 150, etc and return the ID of each row, ideally with some kind of limit. Even if it was only possible to select the IDs of two rows, i.e. row 1 and row 50, that would be good too. It's almost like I need a "step" function, like in a FOR NEXT statement, only SQL-side. -- Best regards, Richard mailto:rich@launchcode.co.uk

« previous php.db (#31862) next »