View Single Post
Old 03-07-2013, 08:24 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Nope, I think you have it right.

Though doing it like this *MIGHT* be more efficient:
Code:
SELECT T1.*
FROM table AS T1,
     ( SELECT column, COUNT(column) AS cnt
       FROM table 
       GROUP BY column
       HAVING cnt > 1
    ) AS T2
WHERE T1.column = T2.column
ORDER BY T1.column
Or even possibly (though I doubt it)
Code:
SELECT T1.*
FROM table AS T1,
     ( SELECT column, COUNT(column) AS cnt
       FROM table 
       GROUP BY column
    ) AS T2
WHERE T1.column = T2.column AND T2.cnt > 1
ORDER BY T1.column
May not matter, but you could try it.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote