Address to mailing list from Database

Getting your data onto paper - or the web - Discussing the reports features of Base

Address to mailing list from Database

Postby coretj » Fri May 18, 2012 6:08 pm

I built a form and table. The Data I'm inputting has multiple contacts and addresses per record.

I need to be able to print out a mailing list for each contact but I can't figure out how.

I'm new at this so please help me using easy to understand explanations.
OpenOffice 3.2.0.10 || OOO320m12 Build (9483)
Ubuntu 10.04 LTS
coretj
 
Posts: 1
Joined: Fri May 18, 2012 6:00 pm

Re: Address to mailing list from Database

Postby Villeroy » Fri May 18, 2012 6:23 pm

Each contact can have more than one address, so this is a many-to-many relation which requires 3 tables just like the relation between persons and things in the database attached to this topic: viewtopic.php?f=100&t=40444
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26632
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Address to mailing list from Database

Postby Villeroy » Fri May 18, 2012 7:29 pm

OK, you may also implement a one-to-many relation where you collect contacts and addresses where each address belongs to one person with a slight chance of duplicate addresses.
You get the full mailing list from
Code: Select all   Expand viewCollapse view
SELECT <personal fields>, <address fields> FROM "PersonTable","AddressTable" WHERE "PersonTable"."ID"="AddressTable"."PersonID"


If you want to keep a single table since no contact will ever have more than two or three addresses, then you get all the addresses with a query like this one:
Code: Select all   Expand viewCollapse view
SELECT <personal fields>, <address_1 fields> FROM "table name" WHERE (NOT "City_1" IS NULL) AND (NOT "Addr_1" IS NULL) AND (NOT "ZIP_1" IS NULL)
UNION
SELECT <personal fields>, <address_2 fields> FROM "table name" WHERE (NOT "City_2" IS NULL) AND (NOT "Addr_2" IS NULL) AND (NOT "ZIP_2" IS NULL)
UNION
SELECT <personal fields>, <address_3 fields> FROM "table name" WHERE (NOT "City_3" IS NULL) AND (NOT "Addr_3" IS NULL) AND (NOT "ZIP_3" IS NULL)

UNIONs need to be run in direct SQL mode.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26632
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Reporting

Who is online

Users browsing this forum: No registered users and 1 guest