问题描述
- 求解SQL问题 代码帮调试运行 求运行结果截图
- CREATE TABLE Course
(
KCID char(10)
LSID char(10)
BCID char(10)
BZC int(10)
EZC int(10)
DSZ int(10)
XQ int(10)
BJC int(10)
EJC int(10)
JSID char(10)
SKXQID char(10)
);
Insert into Course values ('C语言','张三','一班'1161112'301教室','延大')
Insert into Course values ('概论','李四','二班'1161112'301教室','延大')
Insert into Course values ('C语言','李四','二班'1161112'301教室','延大')
Insert into Course values ('高数','张三','三班'1161134'401教室','延边科技学院')
Insert into Course values ('概论','钱五','二班'1161134'401教室','延边科技大学')
Select a.*b.*
FROM Course AS a,Course AS b
WHERE a.KCID<>b.KCID and (a.BCID=b.BCID or a.LSID=b.LSID or a.JSID=b.JSID)and a.SKXQID=b.SKXQID and a.EZC<=b.BZC or a.BZC>=b.EZC (a.DSZ=b.DSZ or a.DSZ=0 or b.DSZ=0) and a.XQ=b.XQ and a.EJC<=b.BJC and a.BJC >=b.EJC
解决方案
没结果集
--加粗位置少了AND
Select a.*b.*
FROM Course AS aCourse AS b
WHERE a.KCID<>b.KCID and (a.BCID=b.BCID or a.LSID=b.LSID or a.JSID=b.JSID)and a.SKXQID=b.SKXQID and a.EZC<=b.BZC or a.BZC>=b.EZC AND (a.DSZ=b.DSZ or a.DSZ=0 or b.DSZ=0) and a.XQ=b.XQ and a.EJC<=b.BJC and a.BJC >=b.EJC
解决方案三:
如果把select* 改成 select KCID
解决方案四:
同select -无关,只有条件才会影响结果集,条件不成立
时间: 2024-11-18 02:24:58