select * from (select * from status where 1=1 ".$sch_q." order by stime desc ) as tmp where 1=1 ".$sch_s." group by name
'select * from (select * from (select * from status where 1=1 '.$sch_q.' order by stime desc ) as tmp group by name) as tmpp where status in (0,1,2,3)'.$sch_s
像这种select子查询该怎么优化 有谁可以帮帮忙吗? 万分感谢!!!
注:
$sch_q = ' ';
$sch_s = ' ';
你的这个sql真的能运行么? 第一层子查询里 group by name ,那么查询字段也只能是name或者聚合字段,select * 应该会报错的。