(
sel addr_chmi_nm as col, 1 as layer from batm_jyusho where index(addr_chmi_nm,' ') = 0
union all
sel substr(addr_chmi_nm, index(addr_chmi_nm,' ')+1) as col, 0 as layer from batm_jyusho
union all
sel trim(substr(addr_chmi_nm, 1, index(addr_chmi_nm,' '))) as col, 1 as layer from batm_jyusho where index(addr_chmi_nm,' ') <> 0
union all
sel substr(col, index(col,' ')+1) as col , 0 as layer from temp_table where layer = 0 and index(col,' ') <> 0
union all
sel trim(substr(col, 1, index(col,' '))) as col , 1 as layer from temp_table where layer = 0 and index(col,' ') <> 0
)
sel * from temp_table where layer = 1
No comments:
Post a Comment