March 22nd, 2013, 03:59 AM

Selecting many adjacent columns easily
I need to add many columns together. Here is an example 
SELECT DISTINCT
a.st, (sum_cat1+sum_cat2+sum_cat3+sum_cat4+sum_cat5+sum_cat6+sum_cat7+sum_cat8+sum_cat9+sum_cat10+sum_cat1 1+sum_cat12+sum_cat13+sum_cat14+sum_cat15+sum_cat16+sum_cat17+sum_cat18+sum_cat19+sum_cat20+sum_cat2 1+sum_cat23+sum_cat24+sum_cat25+sum_cat26)/sum_unity
FROM
reportwe_gamesa.gsa_cats_table a
I'm used to a statistical program SPSS where I can do the following
sum_cat1 TO sum_cat26
if the columns are adjacent to each other.
Is there a way to do this in MySql?
Thanks in advance.
Mark
March 22nd, 2013, 05:09 AM

Originally Posted by bbewkram
Is there a way to do this in MySql?
nope