MySQL Forums
Forum List  »  Optimizer & Parser

Re: best way to create 'next' and 'previous' text
Posted by: Bob Field
Date: September 10, 2006 09:01AM

Use the LIMIT clause to only return one row, e.g.:
SELECT textId 
FROM junior_text 
WHERE textcreatedlong >= DATE_ADD( '2006-08-09', INTERVAL -1 DAY ) 
AND textcreatedlong <= DATE_ADD( '2006-08-09', INTERVAL +1 DAY ) 
AND textactive = 1 
ORDER BY textcreatedlong DESC
LIMIT 1

Options: Reply• Quote


Subject
Views
Written By
Posted
Re: best way to create 'next' and 'previous' text
1793
September 10, 2006 09:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.