Oops, I meant to send this to the list.

Rhino

----- Original Message ----- From: "Rhino" <[EMAIL PROTECTED]>
To: "Mester József" <[EMAIL PROTECTED]>
Sent: Friday, January 06, 2006 8:44 AM
Subject: Re: SQL Question



----- Original Message ----- From: "Mester József" <[EMAIL PROTECTED]>
To: "Mysql list" <mysql@lists.mysql.com>
Sent: Friday, January 06, 2006 3:42 AM
Subject: SQL Question


Hy

I want to sum quantites but there is some data that value is negative but users didn't write the - sign before. I can decide which datas are negative.

 I would like something like that

 select sum(moved_quantities) from db
 if moving like 'Move-' then sum seem the move is negative
 else move value is positive

 Is it possible?

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.

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