0
is the following, I am trying to get the result of a subtraction through a query between different columns of the same table.
I have the following table.
As you can see in the table, I have the fact_type column, which can be (expense or revenue) and for each type is inserted a value that is stored in the value column, until then everything is right. However, after inserting the values in the table, I need to obtain the result of the subtraction between the values of tip_lancamento = revenue minus values of tip_lancamento = expense.
I’m trying this way, but it’s making a mistake
SELECT SUM(value) WHERE type_lancing = 'revenue' - SUM(value) type_lancing = 'expense' FROM lancings;
very obg Gabriel, following his solution, I was able to perform the query. Now I’m trying to adapt this query in the structure mvc.
– frdmarkes