我有一张桌子:
MTCN Number RecPrincipalAmount TotalCharges 123 APK123 506.21 258.22
现在我想添加RecPrincipalAmount
和TotalCharges
并将其插入PrincipalAmount
。
我想要这个:
MTCN Number PrincipalAmount 123 APK123 764.43
我想在Crystal Reports中显示所有这些数据。
答案 0 :(得分:1)
select MTCN,
Number,
RecPrincipalAmount+TotalCharges as PrincipalAmount
from YourTable
您可以在添加之前将varchar
转换为float
。
select MTCN,
Number,
cast(RecPrincipalAmount as float)+cast(TotalCharges as float) as PrincipalAmount
from YourTable
或money
如果更合适。
select MTCN,
Number,
cast(RecPrincipalAmount as money)+cast(TotalCharges as money) as PrincipalAmount
from YourTable
答案 1 :(得分:0)
尝试使用它。
SELECT
MTCN,
Number,
CONVERT(FLOAT, RecPrincipalAmount) + CONVERT(FLOAT, TotalCharges) PrincipalAmount
FROM TableName
答案 2 :(得分:0)
使用公式字段:
//{@Principal}
{table.RecPrincipalAmount} + {table.TotalCharges}
答案 3 :(得分:-1)
SELECT SUM(RecPrincipalAmount + TotalCharges ) as "You Column"
FROM Your_Table;