Unanswered: DISTINCT First Name and Last Name for Mail Merge
I'm trying to create a mail merge on my MS SQL database. Many of my owners are entered more than once as they might own multiple properties. I'm trying to write a query where each is only pulled one time and I'm having some trouble. I think I need to use SELECT DISTINCT, but I need to make sure I don't filter out people with the same first name and different last names and vice versa. Thanks!
You can select distinct First/Last names in a subquery, but then which address would you use if the two records do not agree?
Here is one of the simplest methods:
inner join --DistinctNames
(select Max(PrimaryKey) as PrimaryKey
group by FirstName,
on YourTable.PrimaryKey = DistinctNames.PrimaryKey
If it's not practically useful, then it's practically useless.
I hate to post an extension to the question in the same place, but here goes. My owners are listed more than once if they own more than once parcel of land. What I need to do next is continue the merge to each only once, but add up their land acreage amounts and total for each person. Thoughts anyone? Thanks in advance.