日期:2014-05-18  浏览次数:20603 次

在线等,重发一下,求一SQL
@RoomCharges = SUM([TXN_GuestLedgerTxn].[gltAmt])
@Tax = SUM(CASE WHEN [FIN_TaxDetail].[taxdOrdinal] = 1 THEN [FIN_TaxDetail].[taxdValue] ELSE [FIN_TaxDetail].[taxdValue]/100 * @RoomCharges) 

Based on input criteria and conditions: [TXN_GuestLedgerTxn].[gltCCID] = [FIN_ChargeCode].[CCID] AND [FIN_TaxDetail].[taxdTAXID] = [FIN_ChargeCode].[ccTAXID] 


@RoomCharges - @Tax + [NA_StatisticByMarketMix].[statmmTodayNetRevenue]

请返回列,不是变量,该查询还有其他列返回。

------解决方案--------------------
SUM(TXN_GuestLedgerTxn.gltAmt)-(
SUM(CASE WHEN FIN_TaxDetail.taxdOrdinal = 1 
THEN FIN_TaxDetail.taxdValue 
ELSE 0 END)+
SUM(CASE WHEN [FIN_TaxDetail].[taxdOrdinal]<> 1 
THEN [FIN_TaxDetail].[taxdValue]/100 ELSE 0 END)*SUM([TXN_GuestLedgerTxn].[gltAmt]))



解决了,呵呵