0
select SQL_NO_CACHE a.id,
date_format(a.data_cron,'%d/%m/%Y às %H:%i:%s') as data_pt,a.msgal,
a.status,
b.nome,
c.msg,
if((select count(*) from moips_temps where envio_id=a.id group by envio_id) > 0,1,0) as senvio,
if((select count(*) from moips_temps2 where envio_id=a.id group by envio_id) > 0,1,0) as senvio2
from moips_envios a,
moips_listas b,
moips_msgs c
where a.lista_id = b.id
and a.msg_id = c.id
and a.moips_id = 44
order by a.id desc
時間:0.0146mysqlのダブルカウントでダブル左結合?
select SQL_NO_CACHE a.id,date_format(a.data_cron,'%d/%m/%Y às %H:%i:%s') as data_pt, a.msgal, a.status, b.nome, c.msg,
if(count(d.envio_id) > 0,1,0) as senvio,
if(count(e.envio_id) > 0,1,0) as senvio2
from moips_envios a
left join moips_temps d
on a.id=d.envio_id
left join moips_temps2 e
on a.id=e.envio_id, moips_listas b, moips_msgs c
where a.lista_id=b.id
and a.msg_id=c.id
and a.moips_id=25
group by a.id
order by a.id desc
時間:0.1107
なぜサブクエリを数えるが、より高速ですか? MySQLのみで利用可能
Plsのフォーマットあなたのコード/クエリ - 読みにくく、我々が助けようとする可能性は低い。 –
ok私はそれを行うでしょう –
1は私のためにそれを説明することができますか? –