>Select sif_no, MIN(class_code) AS class_code, MAX(salary) AS salary ; > from tmpmem_class a ; > GROUP BY 1 ; > INTO Cursor tmpmax >>>I have a table with the following fields sif_no, ClassCode, Salary. There are many ClassCodes for a policy. I want to get the ClassCode with the highest salary. See snippet of code below that I use. However, if there is a policy(sif_no) with two class codes with the same salary it will pick up both.
>>***get the max salary and class code >>Select sif_no, class_code, salary ; >> from tmpmem_class a ; >> WHERE salary = ( Select Max(salary) From tmpmem_class b ; >> WHERE a.sif_no = b.sif_no) ; >> INTO Cursor tmpmax >> >>>>