PDA

Click to See Complete Forum and Search --> : Select latest 3 records ONLY


IClarke
Feb 28th, 2001, 11:27 AM
Anyone tell me the SQL query i need to use to do this ? I'm currently using :

SELECT Title, ID FROM NewsArticles WHERE ID > ((SELECT MAX(ID) from NewsArticles)-3) ORDER BY ID DESC

But if the ID fields are not consecutive for whatever reason it will select only 2 or even 1 record.

I'm sure it's something really easy ... i think i'm having a bad day !

Thanks in advance
Ian.

Gaffer
Feb 28th, 2001, 12:11 PM
SELECT TOP 3 ID, Title FROM NewsArticles ORDER BY ID DESC