Instead of deleting rows, just do not include what is not desired, when generating the report.

Assuming all data is duplicate aside from Net Amount, and that the distinction of summed invoice is sufficiently determined by the date and invoice number:

<code>
create table invoices
(shipped date, invnbr int, divnbr int, actnbr int, stonbr int
, taxusd decimal(7, 2), netamt decimal(11, 2))
;
insert into invoices values
('2007-11-06', 1101661, 50, 93584, 7001, 25.54, 125.88)
,('2007-11-06', 1101661, 50, 93584, 7001, 25.54, 299.76)
,('2007-11-06', 1101662, 50, 93584, 7002, 25.54, 125.88)
,('2007-11-06', 1101662, 50, 93584, 7002, 25.54, 299.76)
,('2007-11-06', 1101663, 50, 93584, 7003, 25.54, 125.88)
,('2007-11-06', 1101663, 50, 93584, 7003, 25.54, 299.76)
,('2007-11-06', 1101664, 50, 93584, 7004, 25.54, 125.88)
,('2007-11-06', 1101664, 50, 93584, 7004, 25.54, 299.76)
;
select distinct
a.shipped, a.invnbr, a.divnbr, a.actnbr, a.stonbr
, a.taxusd, (select decimal(sum(S.netamt), 15, 2)
from invoices S
where a.invnbr=S.invnbr
and a.shipped=S.shipped) as netsum
from invoices A
where a.shipped = '2007-11-06'
;
</code>

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.