I wrote the query below, but it's taking over an hour to complete. I understand that access does not have the count(distinct x) function, so I was lead down this path. Any idea if this is wrong or if I can improve its performance. Any assistance would be greatly appreciated.
SELECT A.VendorName AS Vendor, Count(B.PO_Num) As Number_Of_POs
FROM Data AS A,(Select Distinct PO_Num, VendorName from Data) as B
GROUP BY A.VendorName
ORDER BY Count(B.PO_Num) Desc;
What I would like it to return data in the following form: