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.Perhaps it'll help ...
SELECT territory_num, last_name, max(pres_num)
FROM your_table
GROUP BY territory_num, last_name;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment