SELECT CustTable.CustName,CustTable.Balance ,Sum(SalesLine.LineAmt),Salestable.DuesDate
FROM CustTable,Salestable,SalesLine
WHERE CustTable.CustID = Salestable.CustID
And Salestable.SalesID = SalesLine.SalesID
And Salestable.DuesDate > now()
and CustTable.Balance > 1000
GROUP BY CustTable.CustName,CustTable.Balance,Salestable.DuesDate
Order By CustTable.Balance Desc
ไม่มีความคิดเห็น:
แสดงความคิดเห็น