How would I alter the following code so that the Group By function eliminates duplicates from the DocumentHeaders.SoldToFax and DocumentHeaders.ShipToFax fields combined (as a result of the UNION query)(In other words, when the UNION query combines all fax numbers from both the SoldTo and ShipTo fax numbers, there are no duplicated fax number entries)?
(SELECT DocumentHeaders.SoldToFax, Min(DocumentHeaders.SoldToCompany) AS MSoldToCompany, Min(DocumentHeaders.DataSource) AS MinOfDataSource, Min(DocumentHeaders.Remove) AS MinOfRemove, Min(DocumentHeaders.catagoryID) AS MinOfcatagoryID
FROM DocumentHeaders
GROUP BY DocumentHeaders.SoldToFax
HAVING (((DocumentHeaders.SoldToFax)<>""))
UNION
SELECT DocumentHeaders.ShipToFax, Min(DocumentHeaders.ShipToCompany) AS MShipToCompany, Min(DocumentHeaders.DataSource) AS MinOfDataSource, Min(DocumentHeaders.Remove) AS MinOfRemove, Min(DocumentHeaders.catagoryID) AS MinOfcatagoryID
FROM DocumentHeaders
GROUP BY DocumentHeaders.ShipToFax
HAVING (((DocumentHeaders.ShipToFax)<>"")));
(SELECT DocumentHeaders.SoldToFax, Min(DocumentHeaders.SoldToCompany) AS MSoldToCompany, Min(DocumentHeaders.DataSource) AS MinOfDataSource, Min(DocumentHeaders.Remove) AS MinOfRemove, Min(DocumentHeaders.catagoryID) AS MinOfcatagoryID
FROM DocumentHeaders
GROUP BY DocumentHeaders.SoldToFax
HAVING (((DocumentHeaders.SoldToFax)<>""))
UNION
SELECT DocumentHeaders.ShipToFax, Min(DocumentHeaders.ShipToCompany) AS MShipToCompany, Min(DocumentHeaders.DataSource) AS MinOfDataSource, Min(DocumentHeaders.Remove) AS MinOfRemove, Min(DocumentHeaders.catagoryID) AS MinOfcatagoryID
FROM DocumentHeaders
GROUP BY DocumentHeaders.ShipToFax
HAVING (((DocumentHeaders.ShipToFax)<>"")));