List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:July 2 2003 11:07am
Subject:Re: specific records
View as plain text  
Actually, this will *not* necessarily work. Without an ORDER BY 
clause, the database is free to return records in any order; after 
some deletions & insertions, your select below may return different 
records, in a different order.

I would recommend adding an explicit record number to the table, 
using an auto_increment column; it may be more work now, but it will 
be best in the long run.

steve

At 12:02 PM +0200 7/2/03, Maciej Bobrowski wrote:
>O.K. I found the way:
>
>select * from tablename limit 5,6;
>
>it will select 6 records counting from 6.
>
>>>  Let's say I have 1000 records in a 'table'. I want to select rows from6
>>>  to 11. How can I do this?
>>  SELECT * FROM tablename where column>5 AND column<12;
>
>Best regards,
>
>Maciej Bobrowski
>


-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      sbedberg@stripped |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| SETI@Home: 1001 Work units on 23 oct 2002                              |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
+------------------------------------------------------------------------+
Thread
specific recordsMaciej Bobrowski2 Jul
  • Re: specific recordsNils Valentin2 Jul
    • Re: specific recordsMaciej Bobrowski2 Jul
      • Re: specific recordsJoseph Bueno2 Jul
    • Re: specific recordsMaciej Bobrowski2 Jul
      • Re: specific recordsSteve Edberg2 Jul
  • Re: specific recordsDominicus Donny2 Jul
  • Re: specific recordsEgor Egorov2 Jul