请问CI如何多表查询
如: select n.title,n.postdate from news as n,form menu as m where m.menuid=n.newsid在用CI下如何写
谢谢~` $this->db->join
详细看手册 默认,CI可以使用普通sql语句,没必要非得用ar 刚好我这有一个例子: $this->db->select('a.long_id,a.name,a.description,a.configuration,'
.' b.name as catetory,c.name as period,d.name as status,'
.' e.name as type,a.startdate,a.enddate');
$this->db->from('u_projects as a');
$this->db->join('d_project_category as b', 'a.category_id = b.id');
$this->db->join('d_project_period as c', 'a.period_id = c.id');
$this->db->join('d_project_status as d', 'a.status_id = d.id');
$this->db->join('d_project_type as e', 'a.type_id = e.id');
$this->db->order_by('a.name');
$this->db->limit($num);
return $this->db->get(); 还是自己写语句吧。
页:
[1]