/*check selisi pendapatan dan pencairan toko */
select t.total_jajan, t.total_cair, (t.total_jajan - t.total_cair) as saldo from (
    SELECT sum(case when transactions.transaction_type_value=1 then amount else 0 end ) as total_jajan, 
    sum(case when transactions.transaction_type_value=8 then amount else 0 end ) as total_cair 
    FROM `transactions` 
    where store_id = 6
	and transaction_mode_value=1 
) t;