For example I have the following table
+--------+-----------------------+--+
| Id | BuyingAttribute | |
+--------+-----------------------+--+
| 1 | Low Price | |
| 1 | Good Communication | |
| 1 | English Speaker | |
| 2 | Low Price | |
| ...etc | ...etc | |
+--------+-----------------------+--+
Is there a way that I could transfer all the values automatically to yes/No values. I know that I can use case statement like so
SELECT
Id,
CASE WHEN BuyingAttribute = 'Low Price' THEN True ELSE False END AS Buying Attribute
FROM
myTable
However, is there an automated method, because it will be time consuming if I have 50 values and write 50 case statement to generate results like below
+----+-----------------------+---------------+-------------------------+----------------------+
| Id | BuyingAttribute | BA(Low Price) | BA(Good Communication) | BA(English Speaker) |
+----+-----------------------+---------------+-------------------------+----------------------+
| 1 | Low Price | True | False | False |
| 1 | Good Communication | False | True | False |
| 1 | English Speaker | False | False | True |
| 2 | Low Price | True | False | False |
| | | | | |
+----+-----------------------+---------------+-------------------------+----------------------+