Hi Ross,

In MSSql you can use the keyword "TOP" (don't know if it works in access)
ie

SELECT TOP 5 id, title FROM tblDocuments WHERE cat=2 ORDER BY datecreated
DESC

tx
Sonja


|--------+---------------------------->
|        |          Ross Clutterbuck  |
|        |          <[EMAIL PROTECTED]|
|        |          hoo.co.uk>        |
|        |                            |
|        |          2003/09/04 12:55  |
|        |          PM                |
|        |          Please respond to |
|        |          wdvltalk          |
|        |                            |
|--------+---------------------------->
  
>---------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                                         |
  |       To:     [EMAIL PROTECTED]                                                    
                                                   |
  |       cc:                                                                          
                                                         |
  |       Subject:     [wdvltalk] Limiting the number of returned records in 
SQL/ASP/ADO                                                        |
  
>---------------------------------------------------------------------------------------------------------------------------------------------|




Tis I again

Not having much luck at the moment with work so I'm
stuck once more (different project though).

I'm trying to retrieve only the first 5 most recent
articles in a database (Access database and ASP
running from IIS 5.0). Everything works fine but I'm
not making any headway in retrieving only 5 records
from my query.

I've tried the setting the ADO Recordset property
"MaxRecords" to 5 before running my SQL query but,
although it throws up no errors, still retrieves
everything.

[objRS.MaxRecords = 5]

I'm not overly familiar with SQL but I've been told
about LIMIT but that's causing an SQL syntax error in
my ASP debugger - I'm not sure where it should go in
the query string but following examples it still
doesn't work.

["SELECT id, title FROM tblDocuments WHERE cat=2 LIMIT
5 ORDER BY datecreated DESC"]

Any suggestions?

Thanks again you guys...

MOU
(who should take a week off and attend to other issues
before his work suffers again)

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk

____ ? The WDVL Discussion List from WDVL.COM ? ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the
words: "set WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]





____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to