访问MSSQL的SQL语句。我在计算表达式中使用别名时遇到问题。这是一个例子:
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。提前谢谢