DISTINCT vs GROUP BY

Have you ever wondered about the difference between the use of DISTINCT and GROUP BY in your queries? I certainly have. Wonder no more. They are, for all intents and purposes, the same (as demonstrated by Tom).

Even though it requires more typing, but I prefer using GROUP BY (instead of DISTINCT when possible) as it is more explicit about what’s being unique or not in your result set.


Possibly related:


Tagged , , | Post a Comment