Results 1 to 7 of 7
  1. #1
    Join Date
    May 2004
    Posts
    105

    Unanswered: Finding last record of each sequence

    Hi,
    I am having trouble finding the last record of each sequence. For example, if I have a field that contains :

    apple1
    apple2
    apple3
    banana1
    banana2
    banana3
    banana4
    orange2
    orange4
    orange6
    orange10
    orange15

    I need the contents of every fields where apple3, banana4, orange15

    Any suggestions?

  2. #2
    Join Date
    Apr 2004
    Posts
    130
    here is the sql code for it. If it isn't clear, modify the table and field names and paste into a sql query. then display in design view.

    SELECT Table1.Field1, Max(Table1.Field2) AS MaxOfField2
    FROM Table1
    GROUP BY Table1.Field1;

    table has 2 fields.
    Apple 1
    Apple 2
    Pear 1
    Pear 2
    use a group on field 1 and a max on field 2
    works just fine.
    Winston

  3. #3
    Join Date
    May 2004
    Posts
    105
    Not exactly.

    Field1 Field2
    1 apple1
    2 apple3
    3 banana1
    4 banana2
    5 orange3
    6 orange7

    Need these Results:
    2 apple3
    4 banana2
    6 orange7

  4. #4
    Join Date
    Apr 2004
    Posts
    130
    Do a query to split "apple1" etc into "apple" and "1"
    then run the query I suggested with the source data as the first query
    Winston

  5. #5
    Join Date
    May 2004
    Posts
    105
    Hoe do you split the field as you suggested?

  6. #6
    Join Date
    May 2004
    Posts
    105
    Okay, How about this:

    Field1 Field2 Field3 Field4
    1111111 0CA\sd;lkf;sldfks;df CA 01/07/2004
    1111111 0CA\;lsdkf;lsdkf;lsd CA 02/09/2004
    1111111 eioruowieruoruoiru MA 01/02/2004

    Above is kind of what my table is.

    Results (I need the most recent date if Field3 is the same:
    1111111 0CA\;lsdkf;lsdkf;lsd CA 02/09/2004
    1111111 eioruowieruoruoiru MA 01/02/2004

  7. #7
    Join Date
    Apr 2004
    Posts
    130
    can you e-mail me a small version of your db and I will add the queries? Quiet Saturday nite. Make sure you have no security on the db.
    Winston

Posting Permissions

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