2015-07-21 63 views

回答

0

试试这个

$query = $this->db 
->select("*") 
->from("borrow_book") 
->where("isbn=(select isbn from add_book where author='".$this->db->escape_str($author)."')",NULL,false) 
->get(); 

我只想补充,我不熟悉你的数据库结构,但我想大多数的时间加入会比一个子查询

0

更好使用此

$query= $this->db->query("SELECT borrow_book.* 
          FROM borrow_book, add_book 
          WHERE borrow_book.isbn= add_book.isbn AND add_book.author = '$author'"); 
$result= $query->result_array(); 
return $result; 
相关问题