Answer the question
In order to leave comments, you need to log in
Why is it long with phpmyadmin and fast with php (SQL query with nested query-condition)?
I have such a problem.
When working through phpmyadmin, SQL queries of the form
SELECT *
FROM `table-1`
WHERE `table-2-id` IN
(
SELECT `id`
FROM `table-2`
WHERE `condition` = 'condition-value'
)
Answer the question
In order to leave comments, you need to log in
Phpmyadmin for select queries tries to automatically add LIMIT but first executes the same query with SQL_CALC_FOUND_ROWS
Try repeating your query with an explicit LIMIT at the end
SELECT *
FROM `table-1`
WHERE `table-2-id` IN
(
SELECT `id`
FROM `table-2`
WHERE `condition` = 'condition-value'
) LIMIT 999999
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question