How can I get the RM_ID values the belonging to multiple groups in my source data?
I have two columns in my table: RM_ID and Group, with and data like this:
| RM_ID | GROUP |
|---|---|
| 100 | DEF |
| 100 | DEF |
| 200 | ABC |
| 200 | ABC |
| 200 | DEF |
| 300 | XYZ |
| 300 | XYZ |
| 300 | ABC |
| 400 | PQR |
| 400 | PQR |
I want to identify all the
RM_IDwho belong to more than one group, and also retrieve the groups' names'.How can I achieve that in Oracle?
- Will the
LEAD/LAGfunction help here?
- Will the
Desired Result:
| RM_ID | GROUP |
|---|---|
| 200 | ABC |
| 200 | DEF |
| 300 | XYZ |
| 300 | ABC |