sql - Reverse Crosstab Query in Access -


in access 2013, table has following structure:

name   |city   |q113   |q213 peter  |london |20     |30 sandra |paris  |40     |50 

i want "reverse crosstab query", getting following:

name   |city   |period   |value peter  |london |q113     |20 peter  |london |q213     |30 sandra |paris  |q113     |40 sandra |paris  |q213     |50 

i tried union query, using sql:

select [name], [city] ,'q113' [period], [q113] [value] [database] union order [name]        , [city]        , [period] 

however, isn't working, keep getting error: "invalid sql statement expected; 'delete','insert', 'procedure', 'select' or 'update'

googling error didn't much, guess there wrong code above? please help.

you missing query after union all:

select [name], [city] ,'q113' [period], [q113] [value] [database] union select [name], [city] ,'q213' [period], [q213] [value] [database] order [name], [city], [period] 

you need add second part of query , place order last.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -