Results 1 to 4 of 4
  1. #1
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172

    Syntax help: If the value of Field1 is the same, then max value of Field2

    Hi there,

    Hoping someone can help me, as I'm having a brain freeze this morning. I have moved teams at work and am now working with totally different data and I can't figure this out, although I'm sure it isn't hard.

    For example:

    Field1 Field2
    John 10
    John 8
    John 12

    I need a query to bring through only Line3. i.e. if the value in Field 1 is not distinct, then I only want the line where the value in Field2 is the highest (in this case 12).

    Any help much appreciated.



    Kirsti

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Create a "Totals" query. GroupBy Field1. Max Field2.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    I knew it was something simple... couldn't see the wood for the trees. Thanks, worked perfectly.

    Kirsti

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Your welcome.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Update field1 if Null, if Not Null update field2
    By mfirestorm in forum Queries
    Replies: 2
    Last Post: 12-02-2011, 09:51 AM
  2. SQL syntax
    By dssrun in forum Queries
    Replies: 4
    Last Post: 04-15-2011, 01:06 PM
  3. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  4. Please help SQL Syntax
    By jordanturner in forum Access
    Replies: 4
    Last Post: 09-02-2010, 08:05 AM
  5. Update field2
    By Lacutas in forum Access
    Replies: 1
    Last Post: 08-26-2009, 07:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums