I am looking for a faster way to build columns based on a common value. For example, I have extracts that need to have a separate column for each ethnicity. So, a column for White and a value of 'y' or 'n', a column for Asian, same value. Currently, I am building CTE for each ethnicity type and then doing a lot of joins.
Can this be optimized?