Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / July 2006



Tip: Looking for answers? Try searching our database.

How do i display only the first few records in a recordset... no paging

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ryangrayson@gmail.com - 15 Jul 2006 03:44 GMT
How do I display only the first few records in a recordset.  I don't
want paging.  I just want to list the last few additions to a database
and thats it.  Is there a simple way?
Mike Brind - 15 Jul 2006 09:00 GMT
> How do I display only the first few records in a recordset.  I don't
> want paging.  I just want to list the last few additions to a database
> and thats it.  Is there a simple way?

SELECT TOP n <field1>, <field2>, <fieldn> FROM <table> ORDER BY
<field3> DESC

The first n is the number of records you want to select. <field3> is a
field that defines the order in which the records appear - usually an
incremented ID field.

--
Mike Brind
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.