Reputation: 1079
I have two columns in my DB with team names in each column. But, sometimes a team could be in one column, and sometimes it can be in the other column. I want to create a list of distinct, unique, names from both columns combined.
Maybe for further explanation, what I'm trying to say is combine the two columns and then run a distinct query on the combined data to get only unique names out. Thanks!
Upvotes: 1
Views: 215
Reputation: 204766
Use union
to get a distinct list
select team1 as team from your_table
union
select team2 from your_table
Upvotes: 2