Reputation:
I want to use distinct keyword for 3 different tables like intern_data_copy
, fresher_data_copy
, exp1_data
.
These tables have three different columns. Now I want to use join in then and also use use distinct for that column.
select DISTINCT a.sec_s, b.sec_skill, c.sec_sk
from intern_data_copy a
JOIN fresher_data_copy b ON a.fflag = b.fflag
JOIN exp1_data c ON b.fflag = c.fflag
the output comes in distinct format but for every table. if "java" or ".net" is in 2 different table then it is showing 2 times.
if a data like "java" is available in all of three tables than i want to see it only once. How can I achieve this.
thanks in advance
Upvotes: 0
Views: 301
Reputation: 12704
You could try (I am assuming a few things, so this is a guess):
SELECT fflag, a.sec_s
FROM intern_data_copy a
UNION
SELECT fflag, b.sec_skill
FROM fresher_data_copy b
UNION
SELECT fflag, c.sec_sk
FROM exp1_data c
but you must clarify your question if you want to see answers and not guesses.
Upvotes: 1