Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getting the last record in a child table

M a t t h i e uJul 25 2018 — edited Jul 25 2018

Good day all,

I need some help for a SQL query.

I have 2 tables with these data:

S_RULES

IDNAME
ID1Rule A
ID2Rule B
......

S_RULE_LOG

(Each time my system runs a rule, its invocation is logged in that table)

RULE_IDCREATED
ID101/02/2018
ID102/02/2018
ID109/02/2018
......

So I need to report the last time my rules have been triggered, or not.

So with the above data, my sql output would look like:

RULE NAMELAST USED
Rule A09/02/2018
Rule B
......

Note that rule B has never been triggered but I still want to show it in the report with an empty value in column "LAST USED"

I don't think I can use rownum since it's not the last record in the S_RULE_LOG table that I need.  I need the last record for the combination of rownum for each RULE_ID.

Any help is appreciated

Matthieu

This post has been answered by Hans Steijntjes on Jul 25 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2018
Added on Jul 25 2018
3 comments
592 views