已采纳回答 / Johnny_t
select 1 from dual where null != null;select 1 from dual where null is null;
2019-04-25
select t.ci_id, (select wm_concat(STU_NAME) from PM_STU t1
where instr(STU_IDS,t1.stu_id)>0) STU_NAME from PM_CI t
where instr(STU_IDS,t1.stu_id)>0) STU_NAME from PM_CI t
--答案
select c.ci_id,wm_concat(s.stu_name)
from pm_ci c left join pm_stu s on
instr(c.stu_ids,s.stu_id)>0 group by c.ci_id;
select c.ci_id,wm_concat(s.stu_name)
from pm_ci c left join pm_stu s on
instr(c.stu_ids,s.stu_id)>0 group by c.ci_id;
--插入表pm_stu数据
insert into pm_stu (STU_ID, STU_NAME)
values ('1', '张三');
insert into pm_stu (STU_ID, STU_NAME)
values ('2', '李四');
insert into pm_stu (STU_ID, STU_NAME)
values ('3', '王五');
insert into pm_stu (STU_ID, STU_NAME)
values ('4', '赵六');
insert into pm_stu (STU_ID, STU_NAME)
values ('1', '张三');
insert into pm_stu (STU_ID, STU_NAME)
values ('2', '李四');
insert into pm_stu (STU_ID, STU_NAME)
values ('3', '王五');
insert into pm_stu (STU_ID, STU_NAME)
values ('4', '赵六');
--插入表pm_ci数据
insert into pm_ci (CI_ID, STU_IDS)
values ('1', '1,2,3,4');
insert into pm_ci (CI_ID, STU_IDS)
values ('2', '1,4');
insert into pm_ci (CI_ID, STU_IDS)
values ('1', '1,2,3,4');
insert into pm_ci (CI_ID, STU_IDS)
values ('2', '1,4');
--建表语句
create table pm_ci
(
ci_id VARCHAR2(20) not null,
stu_ids VARCHAR2(100)
);
create table pm_stu
(
stu_id VARCHAR2(20) not null,
stu_name VARCHAR2(100)
);
create table pm_ci
(
ci_id VARCHAR2(20) not null,
stu_ids VARCHAR2(100)
);
create table pm_stu
(
stu_id VARCHAR2(20) not null,
stu_name VARCHAR2(100)
);
已采纳回答 / Amousy
<...code...>用distinct可以找到不重复记录,
select distinct mgr from emp where mgr is not null;上面这条语句的功能可以找到所有老板。很明显King(7839)是包括在里面的,为什么select * from e...
2019-03-24