Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-2007, 02:14 PM
len
 
Posts: n/a
Default Newbie sql question

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-13-2007, 08:22 PM
Kees Nuyt
 
Posts: n/a
Default Re: Newbie sql question

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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:10 PM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.