0
select * from tblprojects where projectID in
(Select ProjectID from tblprojectBackups where Userid = 2 and StatusID = 3)
我有上面的查询。我在PHP MVC CI中使用下面的代码。PHP MVC CI中的子查询问题
$query = $this->_ci->db->select('*')->from('tblproject');
$this->_ci->db->where('`projectid` IN (SELECT `projectid` FROM `tblprojectBackups`
where `StatusID`=3 and `UserID`=2)', NULL, FALSE);
if ($query->num_rows() > 0) {
}
这不工作,并给出错误。我在代码中丢失了什么吗?
如果CI 3中的情况下,你可以使用'get_compiled_select()'。 – Tpojka