SELECT
ti.CustomerNO,
sum( ti.Quantity) as TotalQuantity,
sum( tid.Quantity* tid.Unitprice) as ToalAmount
FROM
tInvoice as ti,tsIvoiceDetail as tid
where ti.Invoiceno = tid.SInvoiceNo
GROUP BY ti.CustomerNO
ORDER BY sum( tid.Quantity* tid.Unitprice)
desc
ti.CustomerNO,
sum( ti.Quantity) as TotalQuantity,
sum( tid.Quantity* tid.Unitprice) as ToalAmount
FROM
tInvoice as ti,tsIvoiceDetail as tid
where ti.Invoiceno = tid.SInvoiceNo
GROUP BY ti.CustomerNO
ORDER BY sum( tid.Quantity* tid.Unitprice)
desc
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货