Jump to content

[SOLVED] Select top 1 and top 2-6 records from MySQL


Lyleyboy

Recommended Posts

Hi all,

 

I am in need of two queries from the same table. I have an ID which is an auto incremented number. There will be some gaps in the ID range.

Query 1,

I want to pull the record with the highest ID

i.e. I have records 1,3,4,6,7,9,11,15,18,20,23 I only want to pull ID 23

 

Query 2,

I want to pull the next five records

i.e. 23,20,18,15 and 11

 

I hope this makes sense to someone.

 

Thanks in advance

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.