Firebird - Select to join two or more rows

0

I have a table with the following structure:

Cliente_id  |  credito  |  debito  |  pedido
     1           100                    1
     1                       150        1
     1            30                    1
     2                       200        2
     2           180                    2

How to make a Select the result look like below?

Cliente_id  |  credito  |  debito  |  pedido
     1           130         150        1
     2           180         200        2

Thank you for your help

    
asked by anonymous 09.09.2016 / 21:20

1 answer

1

I think it would be something like this

select Cliente_id, SUM(credito), SUM(debito), pedido from tabela group by pedido

In this table you change the name of your table, what I did was to group the infos of the same requests and add the value

    
09.09.2016 / 21:29