first commit
This commit is contained in:
548
MMT SQL/ftdry_sum.sql
Normal file
548
MMT SQL/ftdry_sum.sql
Normal file
@@ -0,0 +1,548 @@
|
||||
insert into mmt_ods.mmt_config
|
||||
(file_format,sheet_format,target_table,f1_modified)
|
||||
values
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Trac_H1','Tractor Model'),
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Implement','Make of Implement'),
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Test_Condition_1','Test Condition_1:'),
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Engineer_Comments_1','Test Engineer Comments_1'),
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Manager_Comments_1','Test Manager Comments_1'),
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Test_Condition_2','Test Condition_2:'),
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Engineer_Comments_2','Test Engineer Comments_2'),
|
||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Manager_Comments_2','Test Manager Comments_2')
|
||||
;
|
||||
|
||||
drop table mmt_staging2.mmt_staging_specific_table_deepthi;
|
||||
|
||||
|
||||
create table mmt_staging2.mmt_staging_specific_table_deepthi as
|
||||
select * from mmt_staging1.mmt_staging_generic_table
|
||||
where file_format='FTDRY' and sheet_format ='FTDRY_SUM'
|
||||
and file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
||||
|
||||
|
||||
alter table mmt_staging2.mmt_staging_specific_table_deepthi add column is_rownumber_fetched int;
|
||||
|
||||
|
||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
||||
|
||||
drop table mmt_staging2.mmt_staging_process_table_deepthi ;
|
||||
|
||||
create table mmt_staging2.mmt_staging_process_table_deepthi
|
||||
(like mmt_staging2.mmt_staging_specific_table_deepthi);
|
||||
|
||||
|
||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank int;
|
||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank_tag text;
|
||||
|
||||
|
||||
|
||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified) where file_format ='FTDRY' and
|
||||
sheet_format='FTDRY_SUM';
|
||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified) where file_format ='FTDRY' and
|
||||
sheet_format='FTDRY_SUM';
|
||||
update mmt_ods.mmt_config set F1_source=F1_modified where file_format ='FTDRY' and
|
||||
sheet_format='FTDRY_SUM';
|
||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source) where file_format ='FTDRY' and
|
||||
sheet_format='FTDRY_SUM';
|
||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source) where file_format ='FTDRY' and
|
||||
sheet_format='FTDRY_SUM';
|
||||
|
||||
update mmt_ods.mmt_config set f1_source = replace(f1_source,'_1','')
|
||||
where file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
||||
|
||||
update mmt_ods.mmt_config a
|
||||
set row_number_start=(select min(b.row_number)
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
||||
where trim(upper(F1_source))=trim(upper(column2))
|
||||
and b.is_rownumber_fetched is null)
|
||||
where a.row_number_start is null and a.file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
||||
|
||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
set is_rownumber_fetched=1
|
||||
from mmt_ods.mmt_config b
|
||||
where trim(upper(F1_source))=trim(upper(column2))
|
||||
and b.row_number_start=a.row_number
|
||||
and is_rownumber_fetched is null and b.file_format ='FTDRY' and
|
||||
b.sheet_format='FTDRY_SUM';
|
||||
|
||||
update mmt_ods.mmt_config set f1_source = replace(f1_source,'_2','')
|
||||
where file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
||||
|
||||
update mmt_ods.mmt_config a
|
||||
set row_number_start=(select min(b.row_number)
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
||||
where trim(upper(F1_source))=trim(upper(column2))
|
||||
and b.is_rownumber_fetched is null)
|
||||
where a.row_number_start is null and a.file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
||||
|
||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
set is_rownumber_fetched=1
|
||||
from mmt_ods.mmt_config b
|
||||
where trim(upper(F1_source))=trim(upper(column2))
|
||||
and b.row_number_start=a.row_number
|
||||
and is_rownumber_fetched is null and b.file_format ='FTDRY' and
|
||||
b.sheet_format='FTDRY_SUM';
|
||||
|
||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1
|
||||
where file_format ='FTDRY' and
|
||||
sheet_format='FTDRY_SUM';
|
||||
|
||||
|
||||
update mmt_ods.mmt_config a
|
||||
set row_read_end= (select b.row_number_start
|
||||
from mmt_ods.mmt_config b
|
||||
where b.syspk=a.syspk+1 )
|
||||
where a.file_format='FTDRY' and a.sheet_format='FTDRY_SUM';
|
||||
|
||||
/*update mmt_ods.mmt_config set row_read_end = null where f1_modified ='Implement Details' and
|
||||
file_format='FTDRY' and sheet_format='FTDRY_SUM';*/
|
||||
|
||||
update mmt_ods.mmt_config a
|
||||
set run_time=current_timestamp where a.file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Trac_H1'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Tractor Model' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Implement'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Make of Implement' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Test_Condition_1'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Test Condition_1:' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Engineer_Comments_1'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Test Engineer Comments_1' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Manager_Comments_1'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Test Manager Comments_1' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Test_Condition_2'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Test Condition_2:' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Engineer_Comments_2'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Test Engineer Comments_2' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Manager_Comments_2'
|
||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
||||
join mmt_ods.mmt_config b
|
||||
on a.row_number >=row_number_start
|
||||
and (a.row_number< row_read_end or row_read_end is null)
|
||||
and f1_modified='Test Manager Comments_2' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
||||
order by a.row_number;
|
||||
|
||||
|
||||
CREATE EXTENSION if not exists tablefunc;
|
||||
|
||||
|
||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column a_c text;
|
||||
|
||||
|
||||
update mmt_staging2.mmt_staging_process_table_deepthi set a_c=concat('a_',rank);
|
||||
|
||||
drop table if exists mmt_staging2.FTDRY_SUM_Test_Condition_1_Block;
|
||||
|
||||
create table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
||||
(
|
||||
dummy text,
|
||||
Test_Condition text,
|
||||
Test_Date text,
|
||||
Tractor_Model text,
|
||||
Engine_RPM_set text,
|
||||
PTO_RPM_set text,
|
||||
Gear_Used text,
|
||||
Nominal_Speed_KMPH text,
|
||||
Engine_RPM_Drop_on_straight text,
|
||||
Engine_RPM_Drop_on_turn text,
|
||||
Depth_of_cut_cm text,
|
||||
No_load_speed_kmph text,
|
||||
On_load_speed_kmph text,
|
||||
wheel_slippage_ text,
|
||||
Fuel_consumption_lit_hr text,
|
||||
Area_covered_acr_hr text,
|
||||
Fuel_consumption_lit_Acr text,
|
||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
||||
Fuel_consumption_lit_hr_2 text,
|
||||
Area_covered_acr_hr_2 text,
|
||||
Fuel_consumption_lit_Acr_2 text,
|
||||
Trail_Observations text,
|
||||
Engine_Smoke_on_Load text,
|
||||
Engine_acceleration_smoke text,
|
||||
Draft_Response text,
|
||||
Tractor_Steer_ability text,
|
||||
Tractor_braking_performance text,
|
||||
Front_Visibility text,
|
||||
Implement_Accessibility text,
|
||||
Front_Wheel_dragging_at_turning text,
|
||||
Front_end_lifting_during_operation text,
|
||||
RPM_Recovery_Time text,
|
||||
Engine_Vibration text,
|
||||
Engine_Sound text,
|
||||
Implement_Lifting_Lowering_response text,
|
||||
Pulverization_Quality text,
|
||||
Pulverization_Index text
|
||||
);
|
||||
|
||||
insert into mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
||||
(
|
||||
dummy,
|
||||
Test_Condition,
|
||||
Test_Date,
|
||||
Tractor_Model,
|
||||
Engine_RPM_set,
|
||||
PTO_RPM_set,
|
||||
Gear_Used,
|
||||
Nominal_Speed_KMPH,
|
||||
Engine_RPM_Drop_on_straight,
|
||||
Engine_RPM_Drop_on_turn,
|
||||
Depth_of_cut_cm,
|
||||
No_load_speed_kmph,
|
||||
On_load_speed_kmph,
|
||||
wheel_slippage_,
|
||||
Fuel_consumption_lit_hr,
|
||||
Area_covered_acr_hr,
|
||||
Fuel_consumption_lit_Acr,
|
||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
||||
Fuel_consumption_lit_hr_2,
|
||||
Area_covered_acr_hr_2,
|
||||
Fuel_consumption_lit_Acr_2,
|
||||
Trail_Observations,
|
||||
Engine_Smoke_on_Load,
|
||||
Engine_acceleration_smoke,
|
||||
Draft_Response,
|
||||
Tractor_Steer_ability,
|
||||
Tractor_braking_performance,
|
||||
Front_Visibility,
|
||||
Implement_Accessibility,
|
||||
Front_Wheel_dragging_at_turning,
|
||||
Front_end_lifting_during_operation,
|
||||
RPM_Recovery_Time,
|
||||
Engine_Vibration,
|
||||
Engine_Sound,
|
||||
Implement_Lifting_Lowering_response,
|
||||
Pulverization_Quality,
|
||||
Pulverization_Index
|
||||
)
|
||||
SELECT *
|
||||
FROM crosstab(
|
||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[column3::text,
|
||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
||||
column9::text,column10::text,column11::text,column12::text]) AS val
|
||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Test_Condition_1''
|
||||
ORDER BY generate_series(1,15),2'
|
||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
||||
a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text);
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block add column file_name text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block add column file_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
||||
set file_format='FTDRY';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block add column sheet_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
||||
set sheet_format='FTDRY_SUM';
|
||||
|
||||
create table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
||||
(
|
||||
dummy text,
|
||||
Test_Condition text,
|
||||
Test_Date text,
|
||||
Tractor_Model text,
|
||||
Engine_RPM_set text,
|
||||
PTO_RPM_set text,
|
||||
Gear_Used text,
|
||||
Nominal_Speed_KMPH text,
|
||||
Engine_RPM_Drop_on_straight text,
|
||||
Engine_RPM_Drop_on_turn text,
|
||||
Depth_of_cut_cm text,
|
||||
No_load_speed_kmph text,
|
||||
On_load_speed_kmph text,
|
||||
wheel_slippage_ text,
|
||||
Fuel_consumption_lit_hr text,
|
||||
Area_covered_acr_hr text,
|
||||
Fuel_consumption_lit_Acr text,
|
||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
||||
Fuel_consumption_lit_hr_2 text,
|
||||
Area_covered_acr_hr_2 text,
|
||||
Fuel_consumption_lit_Acr_2 text,
|
||||
Trail_Observations text,
|
||||
Engine_Smoke_on_Load text,
|
||||
Engine_acceleration_smoke text,
|
||||
Draft_Response text,
|
||||
Tractor_Steer_ability text,
|
||||
Tractor_braking_performance text,
|
||||
Front_Visibility text,
|
||||
Implement_Accessibility text,
|
||||
Front_Wheel_dragging_at_turning text,
|
||||
Front_end_lifting_during_operation text,
|
||||
RPM_Recovery_Time text,
|
||||
Engine_Vibration text,
|
||||
Engine_Sound text,
|
||||
Implement_Lifting_Lowering_response text,
|
||||
Pulverization_Quality text,
|
||||
Pulverization_Index text
|
||||
);
|
||||
|
||||
insert into mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
||||
(
|
||||
dummy,
|
||||
Test_Condition,
|
||||
Test_Date,
|
||||
Tractor_Model,
|
||||
Engine_RPM_set,
|
||||
PTO_RPM_set,
|
||||
Gear_Used,
|
||||
Nominal_Speed_KMPH,
|
||||
Engine_RPM_Drop_on_straight,
|
||||
Engine_RPM_Drop_on_turn,
|
||||
Depth_of_cut_cm,
|
||||
No_load_speed_kmph,
|
||||
On_load_speed_kmph,
|
||||
wheel_slippage_,
|
||||
Fuel_consumption_lit_hr,
|
||||
Area_covered_acr_hr,
|
||||
Fuel_consumption_lit_Acr,
|
||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
||||
Fuel_consumption_lit_hr_2,
|
||||
Area_covered_acr_hr_2,
|
||||
Fuel_consumption_lit_Acr_2,
|
||||
Trail_Observations,
|
||||
Engine_Smoke_on_Load,
|
||||
Engine_acceleration_smoke,
|
||||
Draft_Response,
|
||||
Tractor_Steer_ability,
|
||||
Tractor_braking_performance,
|
||||
Front_Visibility,
|
||||
Implement_Accessibility,
|
||||
Front_Wheel_dragging_at_turning,
|
||||
Front_end_lifting_during_operation,
|
||||
RPM_Recovery_Time,
|
||||
Engine_Vibration,
|
||||
Engine_Sound,
|
||||
Implement_Lifting_Lowering_response,
|
||||
Pulverization_Quality,
|
||||
Pulverization_Index
|
||||
)
|
||||
SELECT *
|
||||
FROM crosstab(
|
||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Test_Condition_2''
|
||||
ORDER BY generate_series(1,15),2'
|
||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text);
|
||||
;
|
||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block add column file_name text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block add column file_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
||||
set file_format='FTDRY';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block add column sheet_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
||||
set sheet_format='FTDRY_SUM';
|
||||
|
||||
create table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
||||
(
|
||||
dummy text,
|
||||
Test_Engineer_Comments text
|
||||
);
|
||||
|
||||
insert into mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
||||
(
|
||||
dummy,
|
||||
Test_Engineer_Comments
|
||||
)
|
||||
SELECT *
|
||||
FROM crosstab(
|
||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Engineer_Comments_1''
|
||||
ORDER BY generate_series(1,15),2'
|
||||
) t (col text,a_1 text);
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block add column file_name text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block add column file_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
||||
set file_format='FTDRY';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block add column sheet_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
||||
set sheet_format='FTDRY_SUM';
|
||||
|
||||
create table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
||||
(
|
||||
dummy text,
|
||||
Test_Manager_Comments text
|
||||
);
|
||||
|
||||
insert into mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
||||
(
|
||||
dummy,
|
||||
Test_Manager_Comments
|
||||
)
|
||||
SELECT *
|
||||
FROM crosstab(
|
||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Manager_Comments_1''
|
||||
ORDER BY generate_series(1,15),2'
|
||||
) t (col text,a_1 text);
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block add column file_name text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block add column file_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
||||
set file_format='FTDRY';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block add column sheet_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
||||
set sheet_format='FTDRY_SUM';
|
||||
|
||||
|
||||
create table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
||||
(
|
||||
dummy text,
|
||||
Test_Engineer_Comments text
|
||||
);
|
||||
|
||||
insert into mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
||||
(
|
||||
dummy,
|
||||
Test_Engineer_Comments
|
||||
)
|
||||
SELECT *
|
||||
FROM crosstab(
|
||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Engineer_Comments_2''
|
||||
ORDER BY generate_series(1,15),2'
|
||||
) t (col text,a_1 text);
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block add column file_name text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block add column file_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
||||
set file_format='FTDRY';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block add column sheet_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
||||
set sheet_format='FTDRY_SUM';
|
||||
|
||||
create table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
||||
(
|
||||
dummy text,
|
||||
Test_Manager_Comments text
|
||||
);
|
||||
|
||||
insert into mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
||||
(
|
||||
dummy,
|
||||
Test_Manager_Comments
|
||||
)
|
||||
SELECT *
|
||||
FROM crosstab(
|
||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Manager_Comments_2''
|
||||
ORDER BY generate_series(1,15),2'
|
||||
) t (col text,a_1 text);
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block add column file_name text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block add column file_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
||||
set file_format='FTDRY';
|
||||
|
||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block add column sheet_format text;
|
||||
|
||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
||||
set sheet_format='FTDRY_SUM';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user