× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi guys

I have File with many fields i.e. doc_nr, batch_nr, amount and other. (pair
doc_nr and batch_nr are unique)
Then I create select statement:

select doc_nr, batch_nr from File
group by doc_nr, batch_nr
having sum(amount)=0

which take all records with sum of amount = 0 for pair: doc_nr and batch_nr.

But how I should create DELETE statement which do it for the same
parameters.

example

File

doc_nr batch_nr amount
1 1 100
1 1 -100
1 2 100
1 2 -120
3 4 100


select take records
doc_nr batch_nr amount
1 1 100
1 1 -100

and this records should be deleted so file after delete should contain only
doc_nr batch_nr amount
1 2 100
1 2 -120
3 4 100

Have you any idea?

Regards

Tomek



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2024 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.