我在codeigniter(pyrocms)中创建了一个新闻模块,其中基于类别添加新闻
我在选择的类别
的基础上坚持撤销新闻细节我从前端获取新闻详情的查询是: -
$result='';
$sql= "SELECT `default_news`.*,IFNULL(default_newscategoriesff.name,'N.A.') As category FROM (`default_news`) LEFT outer JOIN `default_newscategories` default_newscategoriesff on default_newscategoriesff.id=`default_news`.`category` WHERE `default_news`.`active` = '1' ORDER BY `updated_on` DESC ";
$allnews = $this->db->query($sql)->result();
return $allnews;
在类别基础上选择新闻详情的条件是什么意味着如果我点击国家类别,它应该显示国家类别下的所有新闻
答案 0 :(得分:0)
试试这个
select a.id, a.name, b.name from default_news as a, default_newscategories as b where a.category=b.id and b.name='national' order by a.id desc;