Thursday, August 16, 2012

a much better solution to Anshu Jain's SQL puzzle

A much better solution for this puzzle is:

SELECT myValue FROM myTable
WHERE myValue NOT IN (
   SELECT myValue FROM myTable
   GROUP BY myValue
   HAVING COUNT(myValue) < 2
)
GROUP BY myValue

No comments:

Post a Comment