只需添加
group by带有
sum聚合功能的子句
SELECt I.InvoiceNumber, I.AmountPaid,sum(O.Amount) AmountFROM OrderInvoice OJOIN Invoice I ON O.InvoiceNumber = I.InvoiceNumber group by I.InvoiceNumber, I.AmountPaid
结果 :
InvoiceNumber AmountPaid Amount123 10 10567 10 10
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)