Sum of two fields

-1

I'm trying to add two fields but I can not make it my structure is this.

INSERT INTO 'servicio' ('id', 'Nombre', 'Caida1', 'Caida2', 'Caida3', 'Caida4', 'Confirmado') 
VALUES
(1, 'TEST', 54, 0, 0, 1, 0),
(2, 'TEST2', 19, 8, 1, 1, 0); 

I tried to use Sum and it gives me an error I do not know what I'm doing wrong and with Count it just tells me the lines SELECT COUNT (*) Drop1, Drop2 FROM service

I try to add Fall1 from line 1 and 2 to get the total for an echo.

    
asked by Vicente 04.11.2018 в 22:25
source

1 answer

0

you do not indicate what the error is, but you could do this:

SELECT SUM(Caida1) as total FROM servicio

That should add all the content of that column and store it in a total variable

On the other hand you can also add two columns in a linear way and return their total sum, for example:

SELECT SUM(Caida1+Caida2) as total FROM servicio
    
answered by 04.11.2018 / 22:52
source