When I perform this query:
SELECT `tablename`.* FROM `something`.`tablename`
I get a table with column names that contain dots:
tablename.c1 | tablename.c2 | tablename.c3
------------------------------------------
a | 1 | 2
b | 1 | 3
I don't want this, I just want the column names c1
, c2
and c3
, I can solve this by writing the following query:
SELECT `tablename`.`c1` as `c1`,
`tablename`.`c2` as `c2`,
`tablename`.`c3` as `c3` FROM `something`.`tablename`
I however have many columns which makes it a very long query. How can I rename the columns from the first query or how can I get this right from the start?
(p.s. the query I'm using contains multiple table references that is why I specify the table name tablename.*
)