SELECT SUBSTR('海城客运公司|中型高一',INSTR('海城客运公司|中型高一', '|', 1, 1) + 1) SR
FROM DUAL;
update product_info pi set pi.brand_id=(
select min(pb.brand_id) from product_brand pb where pb.status=1 and pb.brand_name=SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1)
) where pi.brand_id=0 and SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1) in(
select pb.brand_name from product_brand pb where pb.status=1 and pb.brand_id!=0
) and SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1) is not null;
select pi.name,
INSTR(pi.name, '-', 1, 1) pp,
SUBSTR(pi.name,INSTR(pi.name, '-', 1, 1) + 1) SR, --"adc-dd" 截取获得dd信息
SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1) SR1 --"adc-dd" 截取获得abc信息
from product_info pi where pi.brand_id=0
FROM DUAL;
update product_info pi set pi.brand_id=(
select min(pb.brand_id) from product_brand pb where pb.status=1 and pb.brand_name=SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1)
) where pi.brand_id=0 and SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1) in(
select pb.brand_name from product_brand pb where pb.status=1 and pb.brand_id!=0
) and SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1) is not null;
select pi.name,
INSTR(pi.name, '-', 1, 1) pp,
SUBSTR(pi.name,INSTR(pi.name, '-', 1, 1) + 1) SR, --"adc-dd" 截取获得dd信息
SUBSTR(pi.name,0,INSTR(pi.name, '-', 1, 1) - 1) SR1 --"adc-dd" 截取获得abc信息
from product_info pi where pi.brand_id=0