sql - Select only distinct values from two columns from a table -
if have table such as
1 1 b 1 1 b 2 c 2 c and want select distinct 2 columns get
1 2 b c how can word query? way concatenate columns , wrap them around distinct function operator?
you use union create table of values both columns:
select col1 bothcolumns yourtable union select col2 yourtable unlike union all, union removes duplicates, if come same side of union.
Comments
Post a Comment