Reputation: 9778
I have a list of distributors for the company.
Each has postal mailing information such as address1, address2, city, state, zip
. I'm doing a report for sales using MySQL and want to exclude the duplicated addresses
from the report so it just produces a list of each location. I can't delete it from the database because they (who set this up) use it to have one row per contact for the same distributor.
How can I exclude the duplicated rows from a report? (mysql pseudo-code)
Select address1,address2,city,state,zip from distributors_db
where address1 only exists once?
Thanks!
Upvotes: 0
Views: 74
Reputation: 219864
Use the DISTINCT
keyword in MySQL:
SELECT DISTINCT address1
, address2
, city
, state
, zip
FROM distributors_db
Upvotes: 2