GRY
GRY

Reputation: 724

MySQL alter All Columns In table

I have 4 tables.There are columns in each table which have identical names. Each table has for instance, "id" column.

These make for terrible arrays in PHP.

The solution to my trouble is to prepend column names with the name of the table.

Is there a MySQL statement which would add "name" to the start of every column in name the table? So that the id field in people table would become peopleid, for instance.

Upvotes: 0

Views: 151

Answers (1)

Matthew
Matthew

Reputation: 25763

When you do a select, you can give the column an alias.

SELECT id AS 'PeopleID' FROM People

Upvotes: 1

Related Questions