日期:2014-05-16 浏览次数:20867 次
select distinct regexp_substr(sku, '[^-]+', 1,1) sku , regexp_substr(sku, '[^/]+', 1,2) cnt from test_a order by sku
------解决方案--------------------
这个也可以通过截取来统计吧
select distinct substr(sku,0,2),substr(sku,6,length(sku)-6) from tb1
------解决方案--------------------
CREATE TABLE T106 ( ID NUMBER(4), Sku VARCHAR2(20) ); INSERT INTO T106 VALUES(1, '34-1/2'); INSERT INTO T106 VALUES(2, '34-2/2'); INSERT INTO T106 VALUES(3, '39-1/4'); INSERT INTO T106 VALUES(4, '39-2/4'); INSERT INTO T106 VALUES(5, '39-3/4'); INSERT INTO T106 VALUES(6, '39-4/4'); INSERT INTO T106 VALUES(7, '40-1/1');