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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for combining some fields

Status
Not open for further replies.

Mary036

Programmer
Jun 18, 2002
1
US
I am trying to do lables that will - Combine two records if the address field is the same.
My fields are First Name; Last Name; Address, City State; Zip.
It is a membership database. We want the lables to print so that if there are two members in the same household only one lable will print.

Can some one help me.
 
Mary,

The issue here is what name do you then put on the label where two names are associated with the same household.

I'm using an aggregate query as an example of how you might achieve what you want:

SELECT FIRST(FirstName), LastName, Address,
City, State, Zip
GROUP BY City, State, Zip, LastName, Address
ORDER BY City, State, Zip, FIRST(FirstName), LastName, Address

In this example, the household's label will go to the first person associated with the data (based on the alphabetical order of their first name).

There are obviously other ways to do this; for example leaving out the first name altogether, and using the DISTINCT clause on a standard SELECT query.

Hope this helps,
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top