List:General Discussion« Previous MessageNext Message »
From:Mester József Date:January 6 2006 5:07pm
Subject:Re: SQL Question
View as plain text  
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


	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail
http://uk.messenger.yahoo.com
Thread
SQL QuestionMester József6 Jan
  • Re: SQL QuestionGleb Paharenko6 Jan
  • Re: SQL QuestionRhino6 Jan
Re: SQL QuestionMester József6 Jan