Information générale
Catégorie:
Codage, syntaxe et commandes
>>hi all :
>>
>>Hi was trying to make a column with the total's of the other two and paste the result to the next row .... more or less like this:
>>
>>Col a - Col b = total
>>10 0 10
>>0 15 -5
>>
>>Etc...
>>Can i do This with a SQL ? I tryed to use :
>>SELECT a,b, SUM(a+b) as total
>>but it always gives me just one record (with -5)!
>>
>>Thanks in Advance !
>
>Don't use the SUM(), SUM() will always go an aggregate based on either ALL RECORDS, or a given group by...
>
>select a, b, a-b as total from mytable...
First , Thanks for your reply .
But That only give me (a-b) for current record .
What i would like to get is (a-b) from the previous record plus (a-b) from the current record.
EX:
10-1 = 9
10-5 (= 5+9) = 14
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement