sql 语句,错了没有????

来源:百度知道 编辑:UC知道 时间:2024/06/24 12:49:10
select s.name,k.name,c.chengji from Student1 s,KeCheng k,ChengJi c ,Class cl where s.id=c.sid and c.kid=k.id and cl.id=c.clid and k.name=? and cl.name=?

有错。
因为如果from中有n个表,那么where中的连接条件就只需有n-1个即可。
你写的from中有4个表,所以where中只用有3个‘=’。

格式没错

格式上是对的,但还是不能确定执行是不是正确

估计运行起来有问题,建议使用嵌套查询

select s.name,k.name,c.chengji from Student1 s,KeCheng k,ChengJi c ,Class cl where s.id=c.sid and c.kid=k.id and cl.id=c.clid and k.name=? and cl.name=?
GROUP BY s.name,k.name,c.chengji