List:General Discussion« Previous MessageNext Message »
From:Gleb Paharenko Date:January 6 2006 12:10pm
Subject:Re: SQL Question
View as plain text  
Hello.

Do you want something similare to this:

SELECT SUM(IF(moving like 'Move-',-moved_quantities,moved_quantites))
FROM DB;

Have a look here:
  http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html


> 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?
>   
>   Joe
>   
>   
> 
> 		
> ---------------------------------
>   Yahoo! Cars NEW - sell your car and browse thousands of new and used cars online
> search now  
> ---------------------------------
>   


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   Gleb.Paharenko@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com



Thread
SQL QuestionMester József6 Jan
  • Re: SQL QuestionGleb Paharenko6 Jan
  • Re: SQL QuestionRhino6 Jan
Re: SQL QuestionMester József6 Jan