SQL select single distinct values from multiple columns (not combined values) -
for example, have following table:
userid department1 department2 ------------------------------ 1 sales marketing 2 research 3 sales and want following results
distinctdepartments ------------------- sales marketing research i found lots of solutions show me distinct combined values of multiple columns, need overall distinct values, if values in same column.
thankyou
chris
try use union both columns
select department1 tab union select department2 tab note: union command eliminates duplicates
Comments
Post a Comment