[英]Mysql using temporary
My query uses a temporary table, which I'm doing wrong, can someone tell me? 我的查询使用一个临时表,但我做错了,有人可以告诉我吗?
EXPLAIN SELECT DISTINCT t.city_id FROM (SELECT city_id FROM `geo__base` Where country = 'DE')as t
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE geo__base ref country country 8 const 43460 Using index condition; Using where; Using temporar...
Thanks all 谢谢大家
Try something like this: 尝试这样的事情:
SELECT DISTINCT city_id FROM (SELECT city_id FROM geo_base WHERE country = 'DE') tmp;
Or as fancyPants commented above, just use this: 或如上面的fancyPants所述,只需使用以下命令:
SELECT DISTINCT city_id FROM geo_base;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.