Greetings!

I have a system that links two or more records to one head record using a column called ProjID, where ProjID has the unique recNO of the head record. Anyway, what I would like to do is something like this... Imagine,

recNo,ProjID,Invoice,Fund
1,1,,
2,1,10.00,30.00
3,1,20.00,60.00
4,1,100.00,600.00
5,5,,
6,5,8.33,20.00
7,5,1.00,5.00
...
...

recNo is unique. What I would like to do is to keep the head record (1 and 5, on this instance) updated as the other children values get updated. Updated means, the Invoice sum of all the child records on the Invoice column of the head record, and the same for the Fund column. This means that for head record 1, the database, after an update, should be,

recNo,ProjID,Invoice,Fund
1,1,130.00,690.00
2,1,10.00,30.00
3,1,20.00,60.00
4,1,100.00,600.00
...
...

I know how to do this programmatically outside SQLite, but is there a an UPDATE command that I could use to update the Invoice or Fund column on the head record when on any of the children's mentioned column change? I have a lousy idea, which is to set the head record Invoice and Fund column to 0, and then run an add through all the records which have ProjID='1', for the first example, and after that assign the total to the ProjID record. But, is there an easier and more sophisticated way?

It's probably something easy, but I am not THAT good yet, on SQL.

Any help would be greatly appreciated.

thanks,

josé

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to