Jump to content

Recommended Posts

Currently I have a table that is like this. (There are a lot more fields in the real table)

 

ID

Company Name

Property Name

First Name

Last Name

Mailing Address

Property Address

Phone

Fax

Job Type

Job Cost

Job Status

 

What I would like is to have two tables that are relational

Customer Table

ID

Company Name

First Name

Last Name

Mailing Address

Phone

Fax

Job ID

 

Job Table

ID

Property Name

Property Address

Job Type

Job Cost

Job Status

 

One of my problems though is that If the customer was a residential customer and not a business the address has been going into property address and not mailing. Is there a way to split these tables but in the case where mailing address was blank it will insert the property address for the "mailing address in the new tables"?

 

If not I could possible manually do this. How would I go about splitting them in the first place?

I think the best way would be to firstly create the 2 new tables in your db.

 

Then write a PHP script that takes all of your table data into an array. 

 

You can then loop through each array item and INSERT specific columns into the correct table. You could also put an IF statement in your PHP to check for residential or business and insert the correct address.

 

;)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.