×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Be careful with using max(rrn) as it need not necessarily mean the last one
entered
I'm not saying that it isn't, but just be careful.




Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
"If you're going through Hell, keep going" - Winston Churchill

midrange-l-bounces@xxxxxxxxxxxx wrote on 09/26/2007 11:19:08 AM:

I found my answer in the archives.

It's the last detail record entered.

As soon as I sent the email max rrn came to mind.

select file.*
from file join (SELECT max(rrn(file)) as maxrrn
from file
group by keyfld) rrnf
on rrn(file) = maxrrn

Thanks for your help!

Craig

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Shore
Sent: Wednesday, September 26, 2007 11:10 AM
To: Midrange Systems Technical Discussion
Subject: Re: Quick SQL question

High Craig
What denotes the last detail? A timestamp, the highest/lowest value in a
field?
How are the 2 files linked? Account number? Customer number? Home
address?

If you can show us the relevant fields from the 2 files, that would be
helpful.

Thanks in advance



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
"If you're going through Hell, keep going" - Winston Churchill

midrange-l-bounces@xxxxxxxxxxxx wrote on 09/26/2007 10:56:19 AM:

I have two files that I want to query.
A master and a detail.
For each entry in the master file, I have 1 record, and for each master
there are multiple details.
I want to display the master and the last detail, how do I do it?

TIA,

Craig

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

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