这句SQL语言有语法错误吗??

来源:百度知道 编辑:UC知道 时间:2024/09/22 04:03:42
Set rs5 = MyCon.Execute("select distinct count(授课教师) from teacher_info where 状态='正常' and teacher_info.任课校区=(select 考试校区 from exam_sort where id ='" + Format(i) + "') and 监考次数< 2*任课班级数 or 监考次数=(select min(监考次数)from teacher_info) ")

为什么老提示我 '('附近有语法错误??
错了,是这样的:
Set rs5 = MyCon.Execute("select distinct 授课教师 from teacher_info where 状态='正常' and teacher_info.任课校区=(select 考试校区 from exam_sort where id ='" + Format(i) + "') and 监考次数< 2*任课班级数 or 监考次数=(select min(监考次数)from teacher_info) ")

监考次数=(select min(监考次数) 中第一个和第三个括号用错了,用英文的

这里有错吗?
and teacher_info.任课校区=(select 考试校区 from

有的系统不支持 字段=(SELECT语句) 的格式,需要下面这样写:
字段 IN (SELECT语句)

把sql语句拿到数据库的 查询分析器 检查一下不就知道了,笨笨呀