MySQL Forums
Forum List  »  Spanish

Re: Valores Null
Posted by: alvaro salinas
Date: August 30, 2007 12:27PM

bueno, despues de consultar en otros foros, obtuve la respuesta que queria.

hay una sentencia ifnull(campo,0)

y obtuve la siguiente consulta, para sacar saldos (resta entre depositos y retiros):

SELECT campo1, campo2,
SUM(ifnull(retiros,0)),
SUM(ifnull(depositos,0)),
SUM(ifnull(depositos,0)-ifnull(retiros,0))
FROM tabla
GROUP BY campo2

espero que esto ayude a alguien

Options: ReplyQuote


Subject
Views
Written By
Posted
2970
August 29, 2007 12:51AM
Re: Valores Null
2444
August 30, 2007 12:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.