Subtract two sql columns

2

I have a table in postgresql, the structure is as follows:

clientes
---------------------
nombre
apellido
pago
deuda
saldo pendiente

The point is that I want to subtract the fields pago - deuda and the result that appears in saldo pendiente .

Help me? since I do not understand the documentation.

    
asked by Grindor 25.05.2018 в 01:09
source

1 answer

3

you can do this

 select clientes,nombre,apellido,pago,deuda,pago-deuda as pendiente from clientes 

after the from is the name of that table I guess it's called clients

    
answered by 25.05.2018 в 01:31