I want to not have any duplicates in avg function

SELECT SpendsPremissions.DepartmentName, SpendsPremissions.SpendsDate, SpendsPremissions.SpendsNumber, SpendsPremissions.ItemName, Avg(AdditionPermissions.Price) AS AvgOfPrice, AdditionPermissions.UnitQnt, [AvgOfPrice]/[UnitQnt] AS AvgD, Sum(SpendsPremissions.Quantity) AS الأجــمـــالــــى

FROM SpendsPremissions LEFT JOIN AdditionPermissions ON (SpendsPremissions.ItemName = AdditionPermissions.ItemName) AND (SpendsPremissions.SpendsDate = AdditionPermissions.AdditionDate)

GROUP BY SpendsPremissions.DepartmentName, SpendsPremissions.SpendsDate, SpendsPremissions.SpendsNumber, SpendsPremissions.ItemName, AdditionPermissions.UnitQnt

HAVING (((SpendsPremissions.DepartmentName)="بــاريــســتـــا"));

SELECT SpendsPremissions.DepartmentName, SpendsPremissions.SpendsDate, SpendsPremissions.SpendsNumber, SpendsPremissions.ItemName, Avg(AdditionPermissions.Price) AS AvgOfPrice, AdditionPermissions.UnitQnt, [AvgOfPrice]/[UnitQnt] AS AvgD, Sum(SpendsPremissions.Quantity) AS الأجــمـــالــــى

FROM SpendsPremissions LEFT JOIN AdditionPermissions ON (SpendsPremissions.ItemName = AdditionPermissions.ItemName) AND (SpendsPremissions.SpendsDate = AdditionPermissions.AdditionDate)

GROUP BY SpendsPremissions.DepartmentName, SpendsPremissions.SpendsDate, SpendsPremissions.SpendsNumber, SpendsPremissions.ItemName, AdditionPermissions.UnitQnt

HAVING (((SpendsPremissions.DepartmentName)="بــاريــســتـــا"));

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.