Results 1 to 4 of 4

Thread: [RESOLVED] SQl query

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    Resolved [RESOLVED] SQl query

    Hi
    I have an SQL server 2000 table that has a field called "Files".
    I execute the following query:
    Rs.open"Select Files from Books where BDate like ' &sdate1 & "'",cnn,adopenStatic,adlockoptimistic
    it returned the following recordset
    01daily.doc
    05daily.pdf
    04daily.doc
    19daily.doc
    16daily.doc

    Now i want to select the record whose Files value begins with the highest number,in this case
    it's 19daily.doc

    how can i do it?
    thanks in advance

  2. #2
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: SQl query

    Try this :

    VB Code:
    1. Rs.open"Select Files from Books where BDate like '" &sdate1 & "' order by Files desc",cnn,adopenStatic,adlockoptimistic

  3. #3
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: SQl query

    .. or if you JUST want the highest value, then :

    VB Code:
    1. Rs.open"Select max(Files) from Books where BDate like ' & sdate1 & "'",cnn,adopenStatic,adlockoptimistic

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    Re: SQl query

    thanks the BionicOrange

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width