请教 两个表关联查询 function details($id){ $query = $this->db->query("select t1.gradename, t2.* from grade as t1,student as t2 where studentid = '$id' and t2.gradeid = t1.gradeid "); return $query->result(); }
我写语句是错的,执行不了,请大家伙帮一下忙,谢谢。 ------解决思路---------------------- select s.*, g.gradename from student as s left join grade as g on s.gradeid = g.gradeid where s.studentid = $id ------解决思路---------------------- Column 'studentid' in where clause is ambiguous 在where子句中的 studentid 列是含糊的。