----- Original Message ----- From: "Mester József" <[EMAIL PROTECTED]>
To: "Rhino" <[EMAIL PROTECTED]>; "mysql" <mysql@lists.mysql.com>
Sent: Friday, January 06, 2006 12:07 PM
Subject: Re: SQL Question


Hy

If you know which values are supposed to be negative, wouldn't it be easier to do updates to your data to change all of those values to negatives? That should only need to be done once. Then use the normal SQL sum() function to add all of the values together.

Thank you. Actually my first thing was update but my SQL knowledge is weak and I don't want to mess the database. I started a script which is update bad records on a copy of that database. However I didn't solve the update problem.

My script is in (PL/SQL):

integer a;
integer b;
varchar tr;
varchar ra;
varchar ke;
varchar moti;

begin

select tm.tr,tm.ra,tm.ke,tm.moti,tm.mome
into tr,ke,moti,a
from ev98nv_tm tm
where MOTI like 'Rakt.kozi-' or MOTI like 'Kiadas -'
and tm.EV like '2005'

if (a >0) then
a=b;
b = 0- b;
update ev98nv_tm set mome=b where tm.tr=tr and tm.ra=ra and tm.ke=ke and tm.moti=moti ;

end;

But it is not working. The Primary index is tr+ra+ke+moti

Rhino

I'm sorry but I've just got too much to do to help you today. Perhaps Gleb's suggestion can help you do the summing as you originally wanted or perhaps someone else can jump in with suggestions.

Rhino


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.14/222 - Release Date: 05/01/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to