To do :- Sum of Column Value
I have attached the sample output. In the Sample Output, we can see 4 Columns :- GenericCode, NDC, DrugName, Qty.
I need the result by Sum ( Generic Code ) by picking the NDC / DrugName for the Maximum Qty.
For example :- In the Sample Output, we have NDC # 64679072002 , Which has maximum Qty : 450.
And other Generic Code has Qty : 30.
So, expected output should be
4521 64679072002 PHENYTOIN SOD EXT 100 MG CA 480
Sum(TR.[Dispensed Qty]) as Qty
from TransactionReport TR
Group By TR.[Generic Code],TR.NDC,TR.[Drug Name]