3 most recent entries
Hi,
I''ve been flipping through my Coldfusion book and can't seem to find out what kind of code I need to use to display the three most recent blogs in my database... the three highest 'blog_id'; numbers.
Hi,
I''ve been flipping through my Coldfusion book and can't seem to find out what kind of code I need to use to display the three most recent blogs in my database... the three highest 'blog_id'; numbers.
wycks wrote:
I''ve been flipping through my Coldfusion book and can't seem to find out what kind of code
That may be because this is probably not a ColdFusion problem. I presume your blog is stored in a database? If so, then you probably want a database SQL solution. The difficulty here, is that each major database management system has a different solution to this problem.
Examples for some of the biggest:
Postgresql:
SELECT firstname, lastname, email
FROM contacts
LIMIT 3
MS SQL Server:
SELECT TOP 3 firstname, lastname, email
FROM contacts
ORACLE:
SELECT firstname, lastname, email
FROM contacts
WHERE ROWNUM <= 3
mySQL:
SELECT firstname, lastname, email
FROM contacts
LIMIT 3
http://blog.daemon.com.au/archives/000301.html
But if you really wanted to, you could probably get the results you want with the ColdFusion 'maxrows' parameter of the <cfquery...> tag.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.