update catalog_category_entity
set 
path = '1/2/<@PROCESS@>@select trim(substring(IMP_EXTID from 6 for 12)) from IMP_LINK join groups on 
groups.WGROUPID =IMP_LINK.WGROUPID 
join groups gr2 on groups.WGROUPID = gr2.WPARENTGROUP2ID  
where gr2.WGROUPID =
 <@WPARENTGROUP2ID@> and imp_sourceid =<@SOURCEID@> ##/<@PROCESS@>@select trim(substring(IMP_EXTID from 6 for 12)) from IMP_LINK join groups on 
groups.WGROUPID =IMP_LINK.WGROUPID 
where groups.WGROUPID = <@WPARENTGROUP2ID@> and imp_sourceid =<@SOURCEID@> ##',
updated_at = now(),
position = '<@WSORTNO@>'
where entity_id = <@KEY@>
@@GO@@
update catalog_category_entity
set 
parent_id = <@PROCESS@>@select trim(substring(IMP_EXTID from 6 for 12)) from IMP_LINK where WGROUPID =
 <@WPARENTGROUP2ID@> and imp_sourceid =<@SOURCEID@> ##,
path = concat(path,'/<@PROCESS@>@select trim(substring(IMP_EXTID from 6 for 12)) 
from IMP_LINK where WGROUPID = <@WGROUPID@> and imp_sourceid =<@SOURCEID@> ##',
updated_at = now(),
position = '<@WSORTNO@>'
where entity_id = <@KEY@>
@@GO@@