if i had 50 records in a database, how would i return 5 records ordered by date, but not actually display the first record? sorry if this is in the wrong forum. thanks
omoutop
1:27 pm on Jun 29, 2007 (gmt 0)
if you know the id you wish to avoid: select * from table where id not in ($bad_id) order by date limit 5
if you dont know the id...
$k=0; // counter $query = "select * from table order by date limit 6"; while () { $k++;
if ($k>1) { // show results }
}
this way you avoid the first record and still show 5 results
darrenG
1:40 pm on Jun 29, 2007 (gmt 0)
Use the limit clause
select * from table where .....etc order by date (asc/desc) limit 1, 5
That tells MySQL to include results from position 1 (excludes position 0), and to limit the results to no more than 5 rows.