0
我需要获取在列中具有重复值的行。这是SQL:如何获得具有更好性能的重复值的行
select * from `match` where `match`.`homeTeam` in
(select `matchView`.`homeTeam` from `matchView`
group by `matchView`.`homeTeam` having (count(0) > 1))
order by `match`.`homeTeam`
它完成这项工作,但需要15秒。我能做些什么来提高它的速度
编辑:解释SQL结果:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY match ALL NULL NULL NULL NULL 2691 Using where; Using filesort
2 DEPENDENT SUBQUERY match ALL NULL NULL NULL NULL 2691 Using where; Using temporary; Using filesort
您可以加入'exaplain'结果和表结构? –
你已经在列中有索引了吗? –
@dragoste我在phpmyadmin中添加了解释sql,如果这是你问的 – user3354638