This SQL query creates a view that selects and unions data from multiple payroll tables. It selects assignment IDs, element names, element types, input value names, and screen entry values from tables related to payroll elements and entries. It also calculates the maximum screen entry value plus one for each group of assignment ID, element name, element type, and input value name.
This SQL query creates a view that selects and unions data from multiple payroll tables. It selects assignment IDs, element names, element types, input value names, and screen entry values from tables related to payroll elements and entries. It also calculates the maximum screen entry value plus one for each group of assignment ID, element name, element type, and input value name.
This SQL query creates a view that selects and unions data from multiple payroll tables. It selects assignment IDs, element names, element types, input value names, and screen entry values from tables related to payroll elements and entries. It also calculates the maximum screen entry value plus one for each group of assignment ID, element name, element type, and input value name.
This SQL query creates a view that selects and unions data from multiple payroll tables. It selects assignment IDs, element names, element types, input value names, and screen entry values from tables related to payroll elements and entries. It also calculates the maximum screen entry value plus one for each group of assignment ID, element name, element type, and input value name.
PETF.element_name, PEEF.element_type_id, PIVF.NAME, PEEVF.screen_entry_value from PAY_ELEMENT_ENTRIES_F PEEF, Pay_Element_Types_f PETF, PAY_ELEMENT_ENTRY_VALUES_F PEEVF, PAY_INPUT_VALUES_F PIVF WHERE PETF.element_type_id = PEEF.element_type_id AND PEEVF.INPUT_VALUE_ID = PIVF.INPUT_VALUE_ID AND PEEF.element_entry_id = PEEVF.element_entry_id UNION ALL Select PEEF.assignment_id, PETF.element_name, PEEF.element_type_id, PIVF.NAME, TO_CHAR((MAX(PEEVF.screen_entry_value)+1)) from PAY_ELEMENT_ENTRIES_F PEEF, Pay_Element_Types_f PETF, PAY_ELEMENT_ENTRY_VALUES_F PEEVF, PAY_INPUT_VALUES_F PIVF WHERE PETF.element_type_id = PEEF.element_type_id AND PEEVF.INPUT_VALUE_ID = PIVF.INPUT_VALUE_ID AND PEEF.element_entry_id = PEEVF.element_entry_id GROUP By PEEF.assignment_id, PETF.element_name, PEEF.element_type_id, PIVF.NAME;