Professional Web Applications Themes

Database query, part of records - ASP Database

Hello! I have some records in a database (access), like this: 001111-10 001111-11 001111-12 002222-10 002222-11 002222-12 I need to retrive the first record of each sequence, "001111-10" and "002222-10" in the example above. Next part is I need to show only the first part of each record, "001111" and "002222" on an Active Server Page (ASP). Help with any part of this would be appreciated. BR/Peter...

  1. #1

    Default Database query, part of records

    Hello!
    I have some records in a database (access), like this:

    001111-10
    001111-11
    001111-12
    002222-10
    002222-11
    002222-12

    I need to retrive the first record of each sequence, "001111-10" and
    "002222-10" in the example above.

    Next part is I need to show only the first part of each record,
    "001111" and "002222" on an Active Server Page (ASP).

    Help with any part of this would be appreciated.

    BR/Peter
    Peter Guest

  2. #2

    Default Re: Database query, part of records

    "Peter" <nu> wrote in message
    news:google.com... 

     

    Is this data stored in one column or 001111 in one column and 10 in
    another?

    What datatypes?

    --
    John Blessing

    http://www.LbeHelpdesk.com - Help Desk software priced to suit all
    businesses
    http://www.room-booking-software.com - Schedule rooms & equipment bookings
    for your meeting/class over the web.
    http://www.lbetoolbox.com - Remove Duplicates from MS Outlook


    John Guest

  3. #3

    Default Re: Database query, part of records

    Here's one way that would work with the sample data you presented.

    sSQL = "select something from somewhere where something like '%-10'"
    Set oRS = yourADOConnection.Execute(sSQL)
    If Not oRS.eof then aData = oRS.GetRows
    oRS.Close : Set oRS = Nothing
    yourADOConnection.Close : Set yourADOConnection = Nothing

    If Not IsEmpty(aData) Then
    For i = 0 To UBound(aData)
    Response.Write Replace(aData(0,i),"-10","") & "<br>"
    Next
    Else
    Response.Write "None found."
    End If

    Ray at work

    "Peter" <nu> wrote in message
    news:google.com... 


    Ray Guest

Similar Threads

  1. Replies: 1
    Last Post: December 20th, 04:42 PM
  2. Pulling part of test out of a field in a database?
    By lazerbrains555 in forum Macromedia ColdFusion
    Replies: 6
    Last Post: March 11th, 07:42 PM
  3. Query problem part 2
    By tejun in forum Coldfusion Database Access
    Replies: 1
    Last Post: February 21st, 10:40 PM
  4. Using a & in a query that is actually part of a name
    By Phillip Windell in forum ASP Database
    Replies: 19
    Last Post: January 19th, 07:50 AM
  5. Query for decimal part
    By Francisco Roldan in forum Informix
    Replies: 5
    Last Post: August 21st, 07:06 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139