This is the data
Demand is in the table to find all the repeat email
I wrote two SQL
SELECT
R.e mail
The FROM
(SELECT
E.e mail,
Count (e.e mail) as num
The FROM
Email e
GROUP BY
E.e mail) r
Where
R.n um & gt; 1
SELECT
E.e mail
The FROM
Email e
GROUP BY
E.e mail
HAVING
Count (e.e mail) & gt; 1
Compare two statement execution efficiency, found that nested query using time will be less than useful Having query
question: why is nested query time less than practical Having query
CodePudding user response:
This depends on the specific content and table structure, dataNormally, do not advocate using HAVING, still can use index way to speed up,