我需要 TrasactionPaymentsDetails 中的金额总和
DECLARE @mydate DATETIME
SELECT @mydate = '2012-07-28'
select sum(rd.Amount) as total,rp.TransactionCode, rp.ReferenceDate,rp.TransactionFlag,rd.Amount
from ReceiptsPayments rp,ReceiptsPaymentsDetail rd where
ReferenceDate >= DATEADD(dd,1-day(@mydate),@mydate)
and ReferenceDate <= DATEADD(dd,0-day(DATEADD(mm,1,@mydate)),DATEADD(mm,1,@mydate))
and TransactionFlag='P';
以下是错误。请帮忙
消息 8120,级别 16,状态 1,第 6 行列“ReceiptsPaymentsDetail.TransactionCode”在选择列表中无效,因为它不包含在聚合函数或 GROUP BY 子句中。