DaveGreeko
IS-IT--Management
I really gave up on this problem and your help will really save my job. I have a DB with 2 tables to rate telephone calls. First Table stores the rate for each International destination and the second table stores the call records. Here is a real data from both tables:
tblRate(3 Fieleds):
DialCode,DestinationName,Rate
Sample Data:
49,Germany,0.02
491,Germany Mobile,0.18
4930,Germany Berlin,0.01
tblCall_Log(5 Fields)
CallId,CallDate,DialedNumber,Duration,Amount
Sample Data:
1,10/18/2006 10:09:45 AM,49148759654,3.5,NULL
2,10/18/2006 10:18:06 AM,49307896445,18.1,NULL
3,10/18/2006 10:30:31 AM,49835411472,2,NULL
All I need is an UPDATE statement to populate the Amount in tblCall_Log by looking up the rate in tblRate and multiply it by Duration of the call based on the prefix of the DialedNumber for example the first call (CallId=1) should be rated at 0.18 because its DialedNumber prefix is 491, Second call (called=2) should be rated at 0.01 because its DialedNumber prefix is 4930. As you can see the last call should be rated at 0.02
Thank you in advance for your help
Dave,
tblRate(3 Fieleds):
DialCode,DestinationName,Rate
Sample Data:
49,Germany,0.02
491,Germany Mobile,0.18
4930,Germany Berlin,0.01
tblCall_Log(5 Fields)
CallId,CallDate,DialedNumber,Duration,Amount
Sample Data:
1,10/18/2006 10:09:45 AM,49148759654,3.5,NULL
2,10/18/2006 10:18:06 AM,49307896445,18.1,NULL
3,10/18/2006 10:30:31 AM,49835411472,2,NULL
All I need is an UPDATE statement to populate the Amount in tblCall_Log by looking up the rate in tblRate and multiply it by Duration of the call based on the prefix of the DialedNumber for example the first call (CallId=1) should be rated at 0.18 because its DialedNumber prefix is 491, Second call (called=2) should be rated at 0.01 because its DialedNumber prefix is 4930. As you can see the last call should be rated at 0.02
Thank you in advance for your help
Dave,