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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -