查询和" 01 "同学学习的课程完全相同的其他同学

查询和" 01 "同学学习的课程完全相同的其他同学

  • sc表

  • Sql语句
select
		sid
from
		(select
				sid,group_concat(cid order by cid) str1
		from
				sc
		group by sid) t1,
		(select
				group_concat(cid order by cid) str2
		from
				sc
		where
				sid='01') t2
where
		t1.str1=t2.str2
and
		t1.sid<>'01'
  • 结果:

原文地址:https://www.cnblogs.com/yizhixiang/p/13663020.html