select PARENT, CHILD, max(DATE_EXECUTION)
from TEST_EXECUTION
group by PARENT, CHILD;
?
Main Topics
Browse All TopicsI have the following table with following data:
CREATE TABLE TEST_EXECUTION
(
PARENT VARCHAR2(10),
CHILD VARCHAR2(10),
DATE_EXECUTION DATE
);
Data:
PARENT CHILD DATE_EXECUTION
---------- ---------- ---------------------
A B 7/22/2008
B C 7/21/2008
B C 7/23/2008
C D 7/21/2008
C D 7/23/2008
D E 7/24/2008
E F 7/24/2008
F G 7/25/2008
G H 7/25/2008
H I 7/25/2008
I J 7/26/2008
J K 7/27/2008
And the Result I am expecting is as follows:
PARENT CHILD DATE_EXECUTION
---------- ---------- ---------------------
A B 7/22/2008
B C 7/23/2008
C D 7/23/2008
D E 7/24/2008
E F 7/24/2008
F G 7/25/2008
G H 7/25/2008
H I 7/25/2008
I J 7/26/2008
J K 7/27/2008
Not being so proficient in high level Database knowledge, I am struggling a bit with this, need help.
If a befitting solution is available in 9i its cool, but even if its 10g, even thats cool.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
ok let me modify the data a bit.
Data:
PARENT CHILD DATE_EXECUTION
---------- ---------- ---------------------
A B 7/22/2008
B C 7/21/2008
B C 7/23/2008
B C 7/24/2008
C D 7/21/2008
C D 7/23/2008
C D 7/24/2008
D E 7/24/2008
E F 7/24/2008
F G 7/25/2008
G H 7/25/2008
H I 7/25/2008
I J 7/26/2008
J K 7/27/2008
Expected Result:
PARENT CHILD DATE_EXECUTION
---------- ---------- ---------------------
A B 7/22/2008
B C 7/23/2008
C D 7/23/2008
D E 7/24/2008
E F 7/24/2008
F G 7/25/2008
G H 7/25/2008
H I 7/25/2008
I J 7/26/2008
J K 7/27/2008
The query given by ishando did work, but it failed in this case.
These are transactions that occur, from time to time.
I want the rowsets containing the first transactions.
and subsequent transactions happening on the day or later.
A, B, C , D etc are the transaction ids.
So I want all the transactions listed, starting from Transactiuon A.
Hence the result expected is.
PARENT CHILD DATE_EXECUTION
---------- ---------- ---------------------
A B 7/22/2008
B C 7/23/2008
C D 7/23/2008
D E 7/24/2008
E F 7/24/2008
F G 7/25/2008
G H 7/25/2008
H I 7/25/2008
I J 7/26/2008
J K 7/27/2008
Where "B C 7/23/2008 " occurs for the first time after "A B 7/22/2008" has been executed.
Thanks
Use this query:
select parent, child, min(date_execution )
from (
select parent, child, date_execution
from (
select parent, child, date_execution , dense_rank() over(order by parent||child) rn
from tbl1)
start with rn = 1
connect by prior rn = rn - 1
and prior date_execution <= date_execution)
group by parent, child
order by parent, child
/
Business Accounts
Answer for Membership
by: raju1105Posted on 2008-08-12 at 00:47:21ID: 22210784
Try the distinct function.
Eg:
select distinct (PARENT), CHILD, DATE_EXECUTION from TEST_EXECUTION order by 1;