> I have a table (see below) where I want to combine the two totals
> below into the 0304KZ6 total so that I can end up with something like the 
> second example.

> current 0304KZ6         6786.11
>         0304KZ6RR       3750.41

> desired 0304KZ6         10536.52
>         0304KZ6RR       0.00

Am  I  correctly assuming that these 2 fields are only an example, and
you probable have more of such constructions?

Then  I'd first try to change the database layout. The above structure
does not seem to be optimal if you need such results more often.

Then,  if you can't change the database, you can try a client approach
(calculate  the  total  of  the  2  fields by a routine in your client
application)  if  you can provide for proper isolation (not having one
field updated while another is read).

If  all  of  this  does not work, consider "execute statement" in PSQL
within  a  StoredProcedure.  It  helps  me  quite  well  in  a similar
situation,  even  though  the experts seem to be quite reluctant about
"execute statement".



Reply via email to