I have attached the input table and output table in below .xlsx sheet
1) I have removed the duplicate rows and sort the INPUT_TABLE i.e., SELECT * FROM "public".INPUT_TABLE ORDER by 2,3 2) Input_table column name should be the column heading for Output_table. 3) Input_table column value should be the rows for Output_table. 4) some values i have mention in null , because its for future record(its might come) 5) please refer the below attached sheet and provide your assistance,