sql当中比较经典的例子

一、如下图,根据提示,完成要求



提示:这里关联了两张表的查询;

使用 instr(a,b)函数关联两张表‘

使用wm_concat(字段名称) 把列数值变成行数值;


结果sql为:
     select   pc.ci_id,wm_concat( ps.stu_name  )  namelist
	from (select  pc.ci_id, ps.stu_name  
	from pn_ci pc,pn_stu
	where   instr(pc.stu_ids,ps.stu_id)>0)
       group by  pc.ci_id;





猜你喜欢

转载自blog.csdn.net/liangwanmian/article/details/79255424
今日推荐