query in sqlite with few condition

A

AC Question

I want to select column 1 with the condition A and its values to be combined. Also, column 2 will be selected with the condition B and its values will be added. Finally, the answer to column 1 is reduced from column 2.

//example columns: id------number------work------baskets

row1=100/buy/1 ***row2=800/buy/1 ***row3=500/sale/1 ***row4=600/buy/2 ***row5=400/sale/2

restNumber(for baskets 1) = (600) - 400 = 200 restNumber(for baskets 2) = (100 + 800) - 500 = 400
 

Forum statistics

Threads
943,595
Messages
6,919,451
Members
3,159,122
Latest member
rabruslik