-
Popualtion Columns Conditionally
I am attempting to modify a simple query. Below is the query:
SELECT DISTINCT RMAN_SUBJOB_DETAILS_T.DB_NAME, RMAN_SUBJOB_DETAILS_T.INPUT_TYPE, MAX(RMAN_SUBJOB_DETAILS_T.END_TIME) AS "END TIME"
FROM RMAN_SUBJOB_DETAILS_T
GROUP BY RMAN_SUBJOB_DETAILS_T.DB_NAME, RMAN_SUBJOB_DETAILS_T.INPUT_TYPE
The output shows 3 columns: Name, Input type, and max end time.
I want to write the query so that I can have three different max end time columns (called 'LAST_ARCH_LOG_BACKUP' , "LAST_LEV1_BACKUP", and "LAST_LEV0_BACKUP") these columns will be populated based on one of three input types ("ARCHIVELOG", "DB INCR" and "FULL" repectively. Is there a way to rewrite my query above so that this output is presented as these five columns:
Name, input type, LAST_ARCH_LOG_BACKUP, LAST_LEV1_BACKUP, LAST LEV0_BACKUP
-
Look for CASE statement that allows you to pivot rows into column.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|