【发布时间】:2015-03-06 22:49:55
【问题描述】:
我想将此查询转换为 codeigniter,但最后一行 - 'not in' 不起作用 (我想要分配表中没有的测试)
SELECT * FROM (`tests` AS A)
INNER JOIN `test_types` AS B ON `A`.`tst_test_type_id` = `B`.`tt_id`
INNER JOIN `app_types` AS C ON `A`.`tst_app_type_id` = `C`.`at_id`
AND tst_id not in (select ast_test_id from assigned_tests)
到目前为止我尝试了什么
$this->db->select('*');
$this->db->from('tests AS A');// I use aliasing make joins easier
$this->db->join('test_types AS B', 'A.tst_test_type_id = B.tt_id', 'INNER');
$this->db->join('app_types AS C', 'A.tst_app_type_id = C.at_id', 'INNER');
$this->db->join('assigned_tests AS D', 'A.tst_id = D.ast_test_id', 'outer');
【问题讨论】:
标签: jquery mysql sql codeigniter join