![]() |
| |||
| I have an ARDTLDB file (AR detail table) which contain primary key Ar_Sid, then policyno, trxtype, amount, and applytono. The trxtype's are 'Inv', 'Cr', 'Dr', 'Pmt'. The problem I have is that a change was made to the program which applies payments (Pmt) and the program overwrote the 'Inv' record with the payment data. Now I need to write a program to recreate the 'Inv' records. I am new to SQL and so is the rest of the company hence stupid mistake no one. I figure I could I have a couple of options; We have a policy table (Primary Key Policy_Sid, Policyno and Premium amount). I could write an SQL statement that reads through the Policy file and comparies it to the ARDTLDB and if it does not find a record create it from the data in the policy. I could also read through the ARDTLDB for 'Pmt' records and then some how read back into the ARDTLDB for 'Inv' record and if not found recreate the record for the Policy file again. I have picked up the book Introduction to SQL about a week ago and have started to learn SQL but I'm not that far in the book yet I have skimmed for the answer and I think I will need to use some type of subquery and maybe a special type of join. If this were just a problem in the book I wouldn't bother the group but this is a problem at work and I have a time crunch. I don't need a detailed answer but some guidenance. Thanks lsumnler |
| |||
| On Sat, 13 Oct 2007 06:14:39 -0700, len <lsumnler@gmail.com> wrote: >I have an ARDTLDB file (AR detail table) which contain primary key >Ar_Sid, then policyno, trxtype, amount, and applytono. The trxtype's >are 'Inv', 'Cr', 'Dr', 'Pmt'. The problem I have is that a change was >made to the program which applies payments (Pmt) and the program >overwrote the 'Inv' record with the payment data. Now I need to write >a program to recreate the 'Inv' records. I am new to SQL and so is >the rest of the company hence stupid mistake no one. I figure I could >I have a couple of options; We have a policy table (Primary Key >Policy_Sid, Policyno and Premium amount). I could write an SQL >statement that reads through the Policy file and comparies it to the >ARDTLDB and if it does not find a record create it from the data in >the policy. I could also read through the ARDTLDB for 'Pmt' records >and then some how read back into the ARDTLDB for 'Inv' record and if >not found recreate the record for the Policy file again. I have >picked up the book Introduction to SQL about a week ago and have >started to learn SQL but I'm not that far in the book yet I have >skimmed for the answer and I think I will need to use some type of >subquery and maybe a special type of join. If this were just a >problem in the book I wouldn't bother the group but this is a problem >at work and I have a time crunch. I don't need a detailed answer but >some guidenance. > >Thanks >lsumnler Restore your backup of that database (status: just before the Pmt program was changed) on a different machine. Next best thing to do would be to evaluate the MySQL logs to find the original INSERTs of Inv rows. If this data has any formal status, please get professional help to keep your auditor and the IRS happy. -- ( Kees ) c[_] The bigger they are, the harder they hit you. (#165) |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |