How to prevent 3 nested MySQL queries from timing out -


i want delete records in t3 field names in t2 missing, if meet record id t1.

the query t1:

select max(id) t1 name1 = "xxx" , user_id = '$id' 

works fine.

the t2 query:

select name2 t2 record in (select max(id) t1 name1 = "xxx" , user_id = '$id') 

also works fine, takes while.

but t3 query:

delete t3 name3 not in (select name2 t2 record in (select max(id) t1 name1 = "xxx" , user_id = '$id')); 

results in "#2006 - mysql server has gone away"

how query result within reasonable time?

i think can use join queries instead?

select name2, max(t1.id)  t2 inner join t1 on t2.t1_id = t1.id name1="xxx" , user_id='$id' 

Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -