Suppose I have the following combinations in my dataset:
**ProductA** **ProductB**
Apple Banana
Apple Orange
Apple Pear
Banana Orange
Banana Pear
Orange Pear
How would I return a complete list of unique products in a single column? Desired output below:
**Products**
Apple
Banana
Orange
Pear
If I do select distinct, I obviously won't get the pear because it's not included in column ProductA.
Any help would be appreciated. Thanks!
You can UNION them together as a single column:
SELECT ProductA AS Products
FROM tablename
UNION
SELECT ProductB
FROM tablename;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With