List:General Discussion« Previous MessageNext Message »
From:Ralf Hüsing Date:October 25 2007 12:55pm
Subject:Re: Select question
View as plain text  
Matthew Stuart schrieb:

 > I've got this statement to select the last two entries in my db:
 >
 > SELECT top 2 *
 > FROM Content
 > ORDER BY ContentID desc
 >
 > and it works fine because it selects the last two items entered into 
the db. However, I only want to be able to select item 2 rather than 
both 1 and 2. How do I do that?

Hi Mat,

"TOP 2" is not MySQL?

However, MySQL knows LIMIT [1] which is more powerful, try:

   SELECT *
   FROM Content
   ORDER BY ContentID DESC
   LIMIT 1,1

regards
   -Ralf

[1]: http://dev.mysql.com/doc/refman/5.0/en/select.html

Thread
Select questionMatthew Stuart25 Oct
  • Re: Select questionRalf Hüsing25 Oct
  • RE: Select questionJerry Schwartz25 Oct