× 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.



You may try the following:

With t as ( select client, transaction, min(date) as MinDate from file group
by etc)
Select b.*
From t join File b on t.client = b.client and t.Transaction = b.Transaction
and MinDate <= b.Date
Where b.Number > 0

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von David FOXWELL
Gesendet: Friday, 11. December 2009 09:37
An: Midrange Systems Technical Discussion
Betreff: SQL puzzle

Can anyone help?


Here is My Transaction File:

Client Transaction date number
X Y 20090101 55
X Y 20090201 0

The field <number> is usually 0, but if not, the user <thinks> that this
will at the first transaction for a client, ie, minimum date value.

I want to prove or disprove this by extracting the 3rd line in the example,
if it exists :

Client Transaction date number
X Y 20090101 55
X Y 20090201 0
X Y 20090301 2

I want any line where number<>0 and date<> min date for client, transaction.

How can I do this?

I tried something like :

With t as ( select client, transaction, min(date) from file group by etc)

Then joining to the file where number >0 and date > min(date), but my
results aren't right.



Thanks.

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-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.