Hi, I have the following table T:
id 1 2 3 4
col a b a c
I want to make a choice that returns id, col when group by (col) has a counter (col)> 1
One way to do this is
SELECT id,col FROM T
WHERE col IN (SELECT col FROM T GROUP BY(col) HAVING COUNT(col)>1);
Inter-choice (right) returns 'a', and the main (left) returns 1, a and 3, a
The problem is that the in in statement looks very slow. In my real case, the results of internal selection have a lot of “col”, about 70,000, and it takes several hours.
At present, it is much faster to make an internal choice, and the main one is to get all identifiers and upcs and local intersection. MySQL should be able to handle this kind of query efficiently.
Can I replace the connection point or something faster?
thank