I just came across a query that does an inner join
on a non-distinct field. I've never seen this before and I'm a little confused about this usage. Something like:
SELECT distinct all, my, stuff
FROM myTable
INNER JOIN myOtherTable
ON myTable.nonDistinctField = myOtherTable.nonDistinctField
(WHERE some filters here...)
I'm not quite sure what my question is or how to phrase it, or why exactly this confuses me, but I was wondering if anyone could explain why someone would need to do an inner join on a non-distinct field and then select only distinct values...? Is there ever a legitimate use of an inner join on a non-distinct field? What would be the purpose? And if there's is a legitimate reason for such a query, can you give examples of where it would be used?