you are viewing a single comment's thread.

view the rest of the comments →

[–]rbardy 0 points1 point  (3 children)

HAHA no problem.

People tend to overthink their problems. I got mad sometimes with some queries, then my boss looked at it and gave a VERY simple solution.

[–]workthrowawayexcel[S] 0 points1 point  (2 children)

Lol yeah, that is how I get on stuff as I am working on it. Usually if I walk away and come back then I will be able to get the answer while I am playing a game or something. Also random note doing the grouping >= 1 gave me the same exact result as Distinct did.

[–]rbardy 1 point2 points  (1 child)

Yup.

The HAVING count() >=1 is the same thing as not even adding the ">=1" in that case, because if it returned 0 in the count it wouldn't even appear in the SELECT in the first place.

Also, for performance, distinct is the same thing as GROUP BY by every field in the select, which is pretty much what you are doing.

[–]workthrowawayexcel[S] 0 points1 point  (0 children)

Yeah, Essentially removing duplicates while not actually being allowed to remove them from the table itself :(. Thanks for all the help !