Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help on Group By Address

Status
Not open for further replies.

katekis

MIS
Feb 12, 2009
66
US
I need help on a query. I am trying to create a mail list.

Below is the query, sometimes there are more then one households living at the same address.

if there are multiple headOfHouse at the same address I want only the one with min(HeadofHouse).

Select HeadofHouse
, FullName = cfmr_first_name + ' ' + cfmr_last_name
, addr1, addr2, city, state, zip
FROM ViewMarketing_StandardExclusions
 
What about a select distinct?

Something along
Code:
SELECT DISTINCT addr1, addr2, city, state, zip, cfmr_first_name + ' ' + cfmr_last_name AS Fullname
FROM ViewMarketing_StandardExclusions
GROUP BY addr1
ORDER BY Fullname

*Disclaimer* I have not tried this... but it might give you a step in the right direction. You may not need to use DISTINCT...


Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top