I am trying to calculate two columns values but I am receiving the following error. The Minus between invoice and payment is a arithmetical operation. Can you please help me.
Controller.php
public function getIndex( Request $request )
{
$this->data['balanceTotal'] = \DB::table('tb_accounts')->select('sum(invoice-payment)')->get();
return view('account.index',$this->data);
}
Index.blade.php
{{ $balanceTotal }}
Error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sum(invoice-payment)' in 'field list' (SQL: select
sum(invoice-payment)
fromtb_accounts
)