1

将 SQL 语句访问到 MSSQL。我在计算表达式中使用别名时遇到问题。这是一个例子:

CASE WHEN AFACL.KGCOMPTI = 0 THEN 0 ELSE AFACL.VARGLINV END AS FaInventory, 
CASE WHEN AFACL.KGCOMPTA = 0 THEN 0 ELSE AFACL.AMOUNT END AS FaPurch, 
CASE WHEN AFACL.KGCOMPTM = 0 THEN 0 ELSE AFACL.VARGLINV * - 1 END AS FaVariance, 
CASE WHEN AFACL.CDTAX = 2  THEN 0 ELSE ROUND((AFACL.MTLIGNE * GTAXL.T2RATE1 / 100), 2) END  AS TaxAmount2,
CASE WHEN AFACL.CDTAX = 3 THEN 0 ELSE ROUND((AFACL.MTLIGNE * GTAXL.T1RATE1 / 100), 2) END AS TaxAmount1 ,  
[FaInventory]+[FaPurch]+[FaVariance]+[TaxAmount2]+[TaxAmount1] AS [Payable]

最后一行不起作用。有人可以帮我解决这个问题吗?我不知道任何 MSSQL,因为我通常使用 MS-Access。先感谢您

4

0 回答 0