您有什么想法,我如何加快后续查询?
[
'format'=>'raw',
'attribute' =>'patron_firstName',
'value' => function($model,$key,$index)
{
$firstName=$name->patron_firstName;
$lastName=$name->patron_lastName;
$fullName=$firstName." ".$lastName;
return $fullName;
}
],
我试过这种方式:
select count(distinct t1.var1)
from table_a t1
join table_b t2 on t1.var2 = t2.var1
and t2.date between '2016-11-05 00:00:00' and '2016-11-10 23:59:59'
and t2.var3 = 3;
但它并不比前一个快
答案 0 :(得分:-2)
select count(distinct(t1.var1))
from table_a t1
join (select * from table_b where date between ('2016-11-05 00:00:00') and ('2016-11-10 23:59:59') and var3 = 3) t2
on t1.var2 = t2.var1;
在执行连接之前应用fiters