My query runs quite slow. I have two lare query's on my page. It has become running slow since I have insert an "in" statement.
SELECT field1, field2, field3, field4, field5, field6,
DATE_FORMAT(field7, '%d-%m') AS field7_1,
DATE_FORMAT(fjield8, '%d-%m') AS field8_1
FROM
table1
where
field9 in (select field1 from table2 where id = '$id_session') OR
field10 in (select field1 from table2 where id = '$id_session')
order by
field7_1 desc
Limit
50, 100";
I think the problem is the part "where field9 in (select field1 from table2 where id = '$id_session')" It is searching in another table for values that have to be in the where clause.
It is taking about 8 sec to load which is to slow. I have reduced the number of records in the database, but that does it not make faster.
Please help.