I am trying to get the DISTINCT value of one column in a table. This column however is INNER JOINED from another table through an id.
When I try to use the DISTINCT on the column, it produces the same results because DISTINCT also takes into account the unique identifier ID. Is there any work around for this to just get the DISTINCT value of a column from a joined table???
EG.
SELECT val1, b.val2, val3
FROM TABLE 1
JOIN (SELECT DISTINCT val2
FROM TABLE 2) AS b ON val1 = b.val2
To provide my solution:
I ended up using a nested distinct through a join and all the unnested values (all 20+) of them had to be wrapped around a MIN(x), seeing as those values didnt matter that much, so long as only one distinct value was returned.