Good day all,
I need some help for a SQL query.
I have 2 tables with these data:
S_RULES
| ID | NAME |
|---|
| ID1 | Rule A |
| ID2 | Rule B |
| ... | ... |
S_RULE_LOG
(Each time my system runs a rule, its invocation is logged in that table)
| RULE_ID | CREATED |
|---|
| ID1 | 01/02/2018 |
| ID1 | 02/02/2018 |
| ID1 | 09/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 NAME | LAST USED |
|---|
| Rule A | 09/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