Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
-- SQL Query 1:- with p as ( select TR.[Generic Code], TR.NDC, TR.[Drug Name], Sum(TR.[Dispensed Qty]) as Qty from TransactionReport TR Group By TR.[Generic Code], TR.NDC,TR.[Drug Name] ) select x.[Generic Code], x.NDC, x.[Drug Name], y.Qty from ( select p.*, row_number() over (partition by [Generic Code] order by Qty desc) rn from p ) x left join ( select [Generic Code], sum(Qty) Qty from p group by [Generic Code] ) y on x.[Generic Code]=y.[Generic Code] where rn=1; -- SQL Query 2 select Dr.GenericCode as [Generic Code],Br.NDC as [NDC],Dr.Name as [Drug Name],Br.Qty as [Qty] from BalanceReport Br Left Join Drug Dr on stuff(Dr.DrugNDCNbr,case when Dr.DrugNDCType in (50, 56) then 1 when Dr.DrugNDCType in (51, 57) then 6 when Dr.DrugNDCType = 52 then 10 end, 0, '0') = Br.NDC