> select a.id_no, a.name, b.account, b.name, sum(a.inv_total), a.inv_status ; > from customer_invoices a, customer_accounts b; > where inv_status=lcoverduestatus and a.id_no=gnclientid and a.name=b.account; > group by b.name ; > into cursor sql_collections readwrite>
select a.id_no, a.name, b.account, b.name, sum(a.inv_total), a.inv_status ; from customer_invoices a, customer_accounts b; where inv_status=lcoverduestatus and a.id_no=gnclientid and a.name=b.account; group by a.id_no, a.name, b.account, b.name, a.inv_status ; into cursor sql_collections readwriteEverything in the SELECT clause is in the GROUP BY clause except the aggregate function SUM().