-1

我有一张桌子:

MTCN 编号 RecPrincipalAmount TotalCharges
123 APK123 506.21 258.22

现在我想添加RecPrincipalAmount并将TotalCharges它们插入到PrincipalAmount.

我要这个:

MTCN 号码 PrincipalAmount        
123 APK123 764.43

我想在 Crystal Reports 中显示所有这些数据。

4

4 回答 4

1
select MTCN,
       Number,
       RecPrincipalAmount+TotalCharges as PrincipalAmount
from YourTable

您可以varcharfloat添加之前将其转换为。

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
于 2013-03-06T09:18:11.137 回答
0

尝试使用这个。

SELECT 
   MTCN,
   Number,
   CONVERT(FLOAT, RecPrincipalAmount) + CONVERT(FLOAT, TotalCharges) PrincipalAmount
FROM TableName
于 2013-03-06T09:38:07.960 回答
0

使用公式字段:

//{@Principal}
{table.RecPrincipalAmount} + {table.TotalCharges}
于 2013-03-07T14:12:43.113 回答
-1
SELECT SUM(RecPrincipalAmount + TotalCharges ) as "You Column"
FROM Your_Table;
于 2013-03-06T09:29:35.507 回答