询问:
SELECT * FROM #__content WHERE featured=1 and catid=$category_id or catid IN
( SELECT id FROM #__categories WHERE parent_id=$category_id )
Featured=1
只在这里工作catid=$category_id
。开始此catid IN
( SELECT id FROM #__categories WHERE parent_id=$category_id )
输出所有行的位置,并且在此位置忽略 features=1。如何添加featured=1
条件catid IN
?
所以基本上它现在看起来像这样:
$query = "SELECT * FROM #__content WHERE featured=1 and catid=$category_id";
$query2 = "SELECT * FROM #__content WHERE catid IN
( SELECT id FROM #__categories WHERE parent_id=$category_id )";