select  isnull(               sum(case  when lcc.iCurrencyID=1  then  lcc.iNumber*fUnitprice                        else  lcc.iNumber*lcc.fUnitprice*lcc.fExchangeRate end)             ,0) as a  from  lccomeslist  as  lcc  where  istatus=1   and lcc.iLCContractID  in   (  select cml.iLCContractID from CmLCContract as cml     where cml.istatus=1 and cml.iLoanCustomerID = 1    )