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

address database query for report 1

Status
Not open for further replies.

LPL1

Technical User
Aug 11, 2004
2
US
I have a database with address information for 1500+
entries. We have 200+ divisions. Each "company" entry
fits into a division. Some fit into several divisions;
there is a field called division, one called div2, one
called div3. I would like to sort this database by
division for a report. Some company names will appear
multiple times based on whether there is an entry in the
div2 or div3 fields. How do I do this?
 
You may play with a normalisation query, something like this:
SELECT division, * FROM yourTable
UNION
SELECT div2, * FROM yourTable WHERE div2 Is Not Null
UNION
SELECT div3, * FROM yourTable WHERE div3 Is Not Null
ORDER BY 1;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks so much. Your answer was exactly what I neede, and it is working perfectly. [2thumbsup] (would have taken me a month to come up with the proper answer)
Thanks, LPL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top