Results 1 to 2 of 2

Thread: Query Problem

  1. #1
    Join Date
    Feb 2004
    Posts
    24

    Unanswered: Query Problem

    I am trying retrieve all records in a table by the max presciption by group of territory.

    In my table I have columns-- IMS_num, last_name, terriorty_num, pres_num

    I want to see all the data by territory and max pres_num
    I am lost.

    I got this far..

    select max(pres_num) from table group by territory_num.

    I do not know how to get the last_name and territory_num displayed.

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Perhaps it'll help ...

    SELECT territory_num, last_name, max(pres_num)
    FROM your_table
    GROUP BY territory_num, last_name;

Posting Permissions

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