My data looks like:
CO PID SID AMT
A12 Z123 1234 200
A12 Z123 1234 300
A12 Z123 5678 400
I need to retrieve the SID that has the maximum amount of the CO/PID/SID group combination and use that value to update a field on another table. So in the example above, I need the sub query to return the value 1234, since that would have the highest amount when summarized.
I thought I could select the SID where MAX(SUM(AMT)), but I get a -112, when using MAX and SUM. Would anyone have a suggestion on how to get the SID with max summarized AMT? Thx.
CO PID SID AMT
A12 Z123 1234 200
A12 Z123 1234 300
A12 Z123 5678 400
I need to retrieve the SID that has the maximum amount of the CO/PID/SID group combination and use that value to update a field on another table. So in the example above, I need the sub query to return the value 1234, since that would have the highest amount when summarized.
I thought I could select the SID where MAX(SUM(AMT)), but I get a -112, when using MAX and SUM. Would anyone have a suggestion on how to get the SID with max summarized AMT? Thx.
Comment