clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3364508 fiddles created (36227 in the last week).

CREATE TABLE permit (b1_alt_id, b1_checklist_comment, b1_checkbox_desc) AS SELECT 'DIF13-001', '27654', 'Certificate Number' FROM DUAL UNION ALL SELECT 'DIF13-001', 'Fiber', 'DIF_Category' FROM DUAL UNION ALL SELECT 'DIF13-002', '1380', 'Certificate Number' FROM DUAL UNION ALL SELECT 'DIF13-002', 'Water', 'DIF_Category' FROM DUAL UNION ALL SELECT 'DIF13-003', '736', 'Certificate Number' FROM DUAL UNION ALL SELECT 'DIF13-003', 'Library', 'DIF_Category' FROM DUAL;
6 rows affected
 hidden batch(es)


SELECT B1_ALT_ID, B1_CHECKLIST_1, B1_CHECKLIST_2 FROM PERMIT PIVOT ( MAX(B1_CHECKLIST_COMMENT) FOR B1_CHECKBOX_DESC IN ( 'Certificate Number' AS B1_CHECKLIST_1, 'DIF_Category' AS B1_CHECKLIST_2 ) );
B1_ALT_ID B1_CHECKLIST_1 B1_CHECKLIST_2
DIF13-003 736 Library
DIF13-001 27654 Fiber
DIF13-002 1380 Water
 hidden batch(es)


SELECT B1_ALT_ID, MAX( CASE B1_CHECKBOX_DESC WHEN 'Certificate Number' THEN B1_CHECKLIST_COMMENT END ) AS B1_CHECKLIST_1, MAX( CASE B1_CHECKBOX_DESC WHEN 'DIF_Category' THEN B1_CHECKLIST_COMMENT END ) AS B1_CHECKLIST_2 FROM PERMIT GROUP BY B1_ALT_ID;
B1_ALT_ID B1_CHECKLIST_1 B1_CHECKLIST_2
DIF13-003 736 Library
DIF13-001 27654 Fiber
DIF13-002 1380 Water
 hidden batch(es)