Click to See Complete Forum and Search --> : Help requested creating a view in MySQL 5.x


scaiferw
05-17-2007, 12:07 PM
I need to create a view to combine two tables with similar records.

One is membership records from the international level of our volunteer organization, about 2,400 records.

The other is information we maintain at the district level on members active at that level, perhaps several hundred records. Each of these records will have a corresponding record in the international table.

The membership number will be the PK in both tables.

Some of the attributes, like email and address, will be present in both tables. It is my intention to allow the members to override the international attributes if, for instance they wish to use a different email or mailing address for their district activities. If the attribute is empty on the district table, the value from the international table will be used.

Now to my question; is it possible to create a view that will go through those duplicated attributes using the one from the appropriate table depending on the criteria explained above?

If so, how would I go about that, can I use IF statements and such in creating a view?

If anyone could point me to samples of such work or an applicable tutorial, that would be great. I've done very simple views in a classroom setting, but that's all.

Many thanks,

Rob