MySQL Forums
Forum List  »  Italian

Re: problema con somme e totali campi
Posted by: Michele Abbondanza
Date: October 17, 2008 01:54AM

Ciao!
allora, se vuoi semplicemente solo la somma della colonna il comando รจ:

select SUM(valore-valore1) As TotDay FROM tabella

se invece vuoi comunque i valori dei campi con a fianco il totale di riga devi fare:

select (valore-valore1) As TotDay,(
select SUM(valore-valore1) As TotDay FROM tabella) as Totale FROM tabella

EDIT: scusa, volevo scrivere il totale di colonna...
se lo vuoi per riga devi fare:

set @a=0;
select (valore-valore1) As TotDay,@a:=@a+(valore-valore1) as subtotale from tabella;



Edited 2 time(s). Last edit at 10/17/2008 03:28AM by Michele Abbondanza.

Options: ReplyQuote


Subject
Views
Written By
Posted
4100
October 16, 2008 02:29AM
Re: problema con somme e totali campi
3764
October 17, 2008 01:54AM


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.