Fantastic! I'll have to check performance tomorrow, but I'm at least getting results now.
I added a comma after fldb below and made the "join" table name match the "with" table name. Other than that, it was an easy conversion to my files and fields.
Sean Porterfield
-----Original Message-----
With tmpDetail as (
select keyfld, flda, fldb
row_number() over(partition by keyfld) RowByKey
from detail
)
Select * from header a
join detail b
on a.keyfld = b.keyfld
and b.RowByKey = 1
Use a key field from the file to start the row number over.
--
Michael Schutte
This email is confidential, intended only for the named recipient(s) above and may contain information that is privileged. If you have received this message in error or are not the named recipient(s), please notify the sender immediately and delete this email message from your computer as any and all unauthorized distribution or use of this message is strictly prohibited. Thank you.
As an Amazon Associate we earn from qualifying purchases.
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.