问题:我如何在文件编号中找到与其他文件编号中的材料至少匹配 X 百分比(例如 >=50%)的材料?
创建表:
CREATE COLUMN TABLE "SCHEMA"."MYTABLE"
(
"DOCUMENT" NVARCHAR(10) DEFAULT '' NOT NULL ,
"POSNR" NVARCHAR(6) DEFAULT '000000' NOT NULL ,
"MATERIAL" NVARCHAR(40) DEFAULT '' NOT NULL,
PRIMARY KEY (
"DOCUMENT",
"POSNR")
) UNLOAD PRIORITY 5 AUTO MERGE
;
插入数据:
INSERT INTO MYTABLE VALUES (100, '10', 'R3');
INSERT INTO MYTABLE VALUES (100, '20', '7000000');
INSERT INTO MYTABLE VALUES (100, '30', '7000010');
INSERT INTO MYTABLE VALUES (100, '40', '7000011');
INSERT INTO MYTABLE VALUES (100, '50', '7000160');
INSERT INTO MYTABLE VALUES (200, '10', 'SW');
INSERT INTO MYTABLE VALUES (200, '20', '7000000');
INSERT INTO MYTABLE VALUES (200, '30', '7000010');
INSERT INTO MYTABLE VALUES (200, '40', '7000011');
INSERT INTO MYTABLE VALUES (200, '50', '7000160');
INSERT INTO MYTABLE VALUES (200, '60', '7000036');
INSERT INTO MYTABLE VALUES (200, '70', '7000040');
INSERT INTO MYTABLE VALUES (200, '80', '7000066');
INSERT INTO MYTABLE VALUES (200, '90', '7000068');
INSERT INTO MYTABLE VALUES (300, '01', '7000160');
INSERT INTO MYTABLE VALUES (300, '11', '7000011');
INSERT INTO MYTABLE VALUES (400, '10', '7000033');
INSERT INTO MYTABLE VALUES (400, '20', '7000034');
INSERT INTO MYTABLE VALUES (400, '50', '7000068');
INSERT INTO MYTABLE VALUES (400, '60', '7000079');