|  | 
 
| 请问这样的表如何写: article表:放的是文章内容
 id   title  content
 1   测试1  测试1内容
 2   测试2  测试2内容
 
 comment表:放的是文章的评论,aid是文章的id
 id  aid  content
 1   1   文章1的评论1
 2   1   文章1的评论2
 3   2   文章2的评论1
 4   2   文章2的评论2
 
 aboutarticle表:放的是关于文章的点击次数aid代表文章的id
 id  aid  hits
 1   1   50
 2      2       100
 
 现在我想做一个像图中一样的文章列表,内容分别显示:标题、内容、评论条数、点击次数。
 我已经用下面的代码查出了文件的标题、内容、点击次数、如何才能同时查出评论条数呢?
 //取得文章列表
 function get_article_list(){
 $this->db->select('content.id,cid,anthor,title,preview,user.id,user.username,content.data,category.category');
 $this->db->from('content');
 $this->db->join('category','category.id=content.cid','left');
 $this->db->join('user','user.id=content.anthor','left');
 //$this->db->join('comment','content.id=comment.aid','left');
 $query = $this->db->get();
 return $query->result();
 }
 }
 
 
   | 
 |