问题
有俩张表,表1 Td,表2 Tc,Td表的case_num字段包含Tc的case_num字段,查找td的case_num字段的值全部在Tc状态为1中。
建表和数据
create table Td (
id varchar(10),
case_num varchar(10),
document_name varchar(200),
PRIMARY KEY (ID)
);
CREATE TABLE Tc (
id varchar(10),
case_num varchar(10),
CASE_NAME varchar(20),
STATUS varchar(10),
PRIMARY KEY (id)
);
SELECT * FROM Td;
SELECT * FROM Tc;
INSERT INTO td (id, case_num, document_name) VALUES (‘1’, ‘A,G,C’, ‘A’);
INSERT INTO td (id, case_num, document_name) VALUES (‘2’, ‘A,F’, ‘B’);
INSERT INTO td (id, case_num, document_name) VALUES (‘3’, ‘F,W’, ‘C’);
INSERT INTO td (id, case_num, document_name) VALUES (‘4’, ‘A,W,A’, ‘D’);
INSERT INTO td (id, case_num, document_name) VALUES (‘5’, ‘A,A,A,AA,A’, ‘F’);
INSERT INTO tc (id, case_num, CASE_NAME, STATUS) VALU