LEND_FUFIL.fufil_money 从物理库和平台数据库中显示得都是“数字”型字段。
我在信息层写了一个sql语句:
SELECT LEND_CONTRACT.name as 合同名称, LEND_CONTRACT.no as 合同编号,
LEND_FUFIL.fufil_money as 贷款金额, LEND_FUFIL.fufil_date as 贷款日期,LEND_CONTRACT.INTEREST_RATE,LEND_FUFIL.ID,LEND_CONTRACT.lend_dept_id,
dealinterest.pay as 应付利息
FROM LEND_FUFIL left outer JOIN LEND_CONTRACT
ON LEND_CONTRACT.id = LEND_FUFIL.lend_contract_id
left join
(select
fufil_id,
isNull(should.value, 0.00) - isNull(returned.value, 0.00) pay
from
(select
fufil_id,
sum(fufil_money * isNull(interest_rate, 0.00) / 365 * datediff(day,startdate,enddate)) value
from
(select
f.id fufil_id,
f.lend_contract_id,
f.fufil_money,
f.fufil_date,
c1.id change_id,
c1.no,
c1.interest_rate,
c1.start_date,
(case when f.fufil_date>c1.start_date then f.fufil_date else c1.start_date end) startdate,
c1.end_date,
isNull(c2.start_date, getdate()) enddate
from lend_fufil f
left join accrual_change c1 on f.lend_contract_id = c1.contract_id
left join accrual_change c2 on c2.no = c1.no+1 and c2.contract_id=c1.contract_id) list
group by fufil_id) should
left join (select fulfil_id, sum(pay_sum) value from return_interest group by fulfil_id) returned on should.fufil_id = returned.fulfil_id
) dealinterest on dealinterest.fufil_id = lend_fufil.id
然后搜索出来,在字段编辑器里面找到 “贷款金额”(就是LEND_FUFIL.fufil_money as 贷款金额)却是字符型的了。。。不知道是什么原因,有没有解决方法,例如加一个函数转换回去。 |