select gamount=case when gamount-aamy!<0 then gamount-aamy else 0 end
from audit inner join goods on audit.gid=goods.gid
where acircs=3