带有in的MySQL Query太慢了

时间:2015-12-16 12:10:31

标签: php mysql

我正在使用这个MySQL查询。它需要6.3秒或更长的时间。

SELECT * FROM `wp_wpds_tlds` WHERE 1 AND `id` IN (SELECT p.`tld_id` id FROM `wp_wpds_category_pivot` p, `wp_wpds_categories` c WHERE c.id=p.category_id AND `category` LIKE '%City%') ORDER BY `tld` ASC

1 个答案:

答案 0 :(得分:-2)

您必须在WHERE后删除 1 AND
SELECT * FROM wp_wpds_tlds WHERE id IN (SELECT p. tld_id id FROM wp_wpds_category_pivot p, wp_wpds_categories c WHERE c.id=p.category_id AND category LIKE '%City%') ORDER BY tld` ASC