Requirements Description
Loc_sys_busi_strategy is a longitudinal table that needs to be converted into a horizontal table to facilitate Redis queue processing.
Source data format
650) this.width=650; "src=" http://img.blog.csdn.net/20160607220002619 "alt=" here write a picture describing "title=" "style=" border:none; "/ >
Requirements format
650) this.width=650; "src=" http://img.blog.csdn.net/20160607220048306 "alt=" here write a picture describing "title=" "style=" border:none; "/ >
Note that the Speed,area is the title heading in the demand format.
Format conversion
Select Busirule_id,element_key,element_val from Loc_sys_busi_strategy;
650) this.width=650; "src=" http://img.blog.csdn.net/20160607220424354 "alt=" here write a picture describing "title=" "style=" border:none; "/ >
Title Heading Conversion
Select busirule_id, ' Speed ' speed, ' area ' area from loc_sys_busi_strategy where 1 = 2 Unionselect busirule_id, Decode (Element_key, Upper (' Speed '), Element_val), Decode (Element_key, Upper ("area"), Element_val) from Loc_sys _busi_strategy;
650) this.width=650; "src=" http://img.blog.csdn.net/20160607220517142 "alt=" here write a picture describing "title=" "style=" border:none; "/ >
Merge
Select busirule_id, To_char (wmsys.wm_concat) speed, To_char (area) area from (select B usirule_id, ' Speed ', "area" area from loc_sys_busi_strategy where 1 = 2 Unionselect busirule_id, Dec Ode (Element_key, Upper (' Speed '), Element_val), Decode (Element_key, Upper ("area"), Element_val) from Loc_sys_ Busi_strategy) Group by busirule_id;
650) this.width=650; "src=" http://img.blog.csdn.net/20160607220611433 "alt=" here write a picture describing "title=" "style=" border:none; "/ >
This article is from the "90SirDB" blog, be sure to keep this source http://90sirdb.blog.51cto.com/8713279/1787893
Row and column conversion _wmsys.wm_concat