SQL query to get unique addresses from a list.
April 18, 2007 11:10 AM
Subscribe
Access SQL Query - I have multiple individuals each with an address. I need to make mailing labels, but if two or more people share an address, I would only like one label.
I have a database with student information. Each student record contains the student's first and last names, and their home address, among other details.
The customer wants to print mailing labels for each "family," a concept that the database has no built-in provision for.* So, I'm looking for a query that would simulate this idea of a family.
Criteria:
Though siblings will have the same last name, obviously last names could be shared between families. The best I can think of is to rely on the fact that siblings should have the same home address. Or, to guard against typos, at least the same street number.
How can I write a query to pull out unique street addresses?
* Alternatively, if you have any good ideas about how to implement the concept of a Family in the database, I'd love to hear some of them.
posted by odinsdream to computers & internet (9 comments total)
2 users marked this as a favorite
SELECT DISTINCT address, lastname, firstname FROM table
posted by chrisamiller at 11:25 AM on April 18, 2007