LEFT JOIN _last_ of matchin entries [message #446741] |
Wed, 10 March 2010 04:20  |
mrQQ
Messages: 1 Registered: March 2010
|
Junior Member |
|
|
Hello,
I have this table:
EntryNo
Date
TypeID
I also have this table
StartDate
EndDate
TypeID
TypeCode
The entries in the second table overlap, for any given time moment there can be more than one matching entry.
I need to join second table to the first one, but take only the last of matching records.
If the entries wouldnt overlap, I could do a left join on StartDate <= Date AND EndDate >= Date AND TypeID=TypeID. But in this case, this would duplicate records.
So how do I do this?
|
|
|
|
Re: LEFT JOIN _last_ of matchin entries [message #446745 is a reply to message #446741] |
Wed, 10 March 2010 04:24  |
 |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
If you post a working Test case: create table and insert statements along with the result you want with these data then we will work with your table and data.
Before please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.
Regards
Michel
|
|
|