【求助】mysql查询三个表
三个表
Classroom 教室表 字段clno 是编号
borrow 借用的教室表 clno usedate 借用时间
schedule 课程表 clno weekday星期 period节次
一个空教室查询语句 要从教室表查询出所有的教室 排除 borrow表中借用的教室和schedule表中有课的教室
我是这么写的,但是不对,不知道该怎么写
str="select * from Classroom where clno like '9%' and clno not in" +
"(select s1.weekday,s1.period,b1.usedate from Schedule s1,borrow b1 "+
"where s1.weekday = '"+weekdayStr+"' and s1.period = '"+periodStr+"' and b1.usedate = '"+dateStr+"')";