I'm pulling data from a database using an Excel pivot table. When I go into Microsoft Query to edit the SQL query, I tried to rename the columns for the pivot table using aliases but keep getting error messages:
SELECT table1.column1 AS "Alias String"
SELECT table1.column1 "Alias String"
SELECT table1.column1 AS my_alias
SELECT table1.column1 my_alias
All of these result in "Syntax Error" messages. I don't want to just rename the columns by hand in the table because when I refresh the data, the names I write get overwritten with the original SQL column names. I'm using Postgresql 8.4 and Excel 2010. What's the syntax I should be using?