I used distinct keyword on one column it did work very well but when I add the second column in select query it doesn't work for me as both columns have duplicate values. So I want to not show me the duplicate values in both columns. Is there any proper select query for that.
The sample data is:
For Col001:
555
555
7878
7878
89.
Col002:
43
43
56
56
56
67
67
67
79
79
79.
I want these data in this format: Col001:
555
7878
89.
Col002:
43
56
67
79
I tried the following query:
Select distinct col001, col002 from tbl1
DISTINCTworks across the entire row considering all values in the row and will remove duplicate values where the entire row is duplicated.For example, given the sample data:
Then:
Outputs:
And the duplicates have been removed.
If you want to only display distinct values for each column then you need to consider each column separately and can use something like:
Which outputs:
db<>fiddle here