Jump to content

Insert/ Select help required


chrisdav

Recommended Posts

I have spent a long time trying to get this one - and I am now questioning my data structure

 

I have the following tables at present (telephone billing system)

 

TABLE -DATA

ID

ACCOUNT NUMBER

CALL TYPE

COUNTRY

CALL LENGTH

SEVERAL OTHER FIELDS NOT RELEVANT

 

TABLE - CUSTOMERS

ACCOUNT NUMBER

RATE TABLE

 

TABLE - RATETABLE

COUNTRY

PEAK

OFFPEAK

WEEKEND

 

On a row by row basis - I wish to update (or insert into a new table) the rate that I wish to charge for a call - taken from the DATA table.

 

e.g.

row 1 DATA contains the following information

ID = 1

ACCOUNT NUMBER = ABC123

CALL TYPE = PEAK

COUNTRY CODE = 44

 

I then get the rate table to be used from customers, and use it to select the correct rate \'where ratetable.country = data.country and ratetable.call type = data.call type\'

 

Have managed to do this in php - takes a very long time tho\' as it is running the script on a WHILE loop and there is approx 500k rows in data.

 

It strikes me there must be a more direct way of doing this - if not I will go back and have a look at my php code.

 

Any thoughts gratefully received - if my data structure (or explanation) could be improved then I will do.

Link to comment
Share on other sites

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.