[wplug-web] schema for mailing lists

James O'Kane jo2y at midnightlinux.com
Wed Feb 19 19:59:47 EST 2003


Assumptions:
People will have many addresses, but only one primary
The column and table names I have below are vague


table mailing_lists {
	id
	other_mailing_list_foo_that_I_need_to_lookup
}

table mailing_list_map {
	user_id
	mailing_list_id
	other_user_specific_options
}

Then we can do a query to get the list of subscribers.
select users.email_address from users,mailing_lists, mailing_list_map 
where users.id = mailing_list_map.user_id AND
mailing_list_map.mailing_list_id = mailing_lists.id AND mailing_lists.id = 
<list wanted>;

That seems complicated to me, and I'm not sure my join is correct.
Is this the right direction?

If my assumption about one primary per person is wrong, we can add 
multiple items to the _map table and add a column called email, and beef 
up the select query.

-james





More information about the Wplug-web mailing list