Bug #51567 Create on Join

Submitted: 26 Feb 2010 22:09 Modified: 27 Feb 2010 13:50
Reporter: ivo welch Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[26 Feb 2010 22:09] ivo welch
Description:
INSERT INTO newtable SELECT * FROM oldtable1 INNER JOIN oldtable2 USING (var1);

this works only if I have defined the newtable before.  if oldtable1 and oldtable2 each have a few hundred columns, this can be rather inconvenient.  all the information is there, though, so if user-specified, why can newtable not copy the schemata of the two old tables?

How to repeat:

standard

Suggested fix:
not sure what syntax would be best.  actually, the statement above could just work as is.
[27 Feb 2010 10:06] Valeriy Kravchuk
Why not just to use existing syntax:

CREATE TABLE newtable AS SELECT * FROM oldtable1 INNER JOIN oldtable2 USING (var1);
[27 Feb 2010 13:49] ivo welch
because I am a newbie and did not know that this could work.

in my defense, I first did ask in the newbie forum for solutions, and I was told that I did have to define the table first.
[27 Feb 2010 13:50] ivo welch
obviously mea culpa.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.