我想做类似的事情:
$dnt = mysql_query('select * from topics WHERE parent != "5" order by timestamp DESC limit 5 ');
while($dnnt = mysql_fetch_array($dnt)){
$dlk = mysql_query('select * from users where id="'.$dnnt['authorid'].'"');
}
我认为我需要使用类似的东西:
$dn1 = mysql_query('select c.XX, c.XXXXX, c.XXX, c.XXX,
(select count(t.XX) from YY as t where t.XXX=c.XX and t.XX1=1) as YY,
(select count(t2.XX) from YY as t2 where t2.XXX=c.XX and t2.XX2!=1) as YYY from YYY as c where c.XXXXX = "...." or c.XXXXX= "..." group by c.XX order by c.XXX
asc ');