2

Is there any way to use a create table with select statement where column names in conflict (or all) are aliased?

CREATE TABLE newTable
SELECT a.*, b.*
FROM tblA a
JOIN tblB b
  ON a.id = b.cid

The issue is that tblA and tblB have a few columns with the same name, so I get a "duplicate column name" error on the create. I'm trying to avoid listing all the fields in the table, so I either need to selectively exclude some columns or apply and "auto alias" to the column names.

lcdservices
  • 841
  • 1
  • 9
  • 20

1 Answers1

1

You can use the information_schema table to selectively exclude columns in a select statement. See the top answer here.

Community
  • 1
  • 1
Bobby W
  • 865
  • 6
  • 8