I have 2 tables, Greeter_Detail and ZipCode_Details
I'm trying to SUM the total of People and Families from and Greeter_Detail and join them on ZipCodes, but I get duplicates. ZipCode_Details has city and county info. Can anyone help, I've been on this for hours. Seems like it should be straight forward. TIA!
SELECT SUM(Families), SUM(People), Zipcode, ZipCode_Detail.Zipcode_D, ZipCode_Detail.City, ZipCode_Detail.County
FROM Greeter_Detail
LEFT JOIN ZipCode_Detail ON Greeter_Detail.Zipcode = ZipCode_Detail.Zipcode_D
WHERE $dateRange
GROUP BY Zipcode
SHOW CREATE TABLE
.SELECT DISTINCT
OR useDISTINCT
in one of the aggregate functions? I feel using the keywordDISTINCT
is the key for your query and this question altogether. Let me know