set @total_balance=0;
select total_balance=if(a.transaction_type='+c') then total_balance=total_balance+a.tran_amount
else if(a.transaction_type='-p'or '-r') then total_balance=total_balance-a.tran_amount
END
from lib_user_account a
where employee_Id='1004';
質問する
58 次