views:

35

answers:

2

Hey folks,

In oracle-db it is possible to insert values from table A to table B like

Insert into table_a values
 Select * from table_b where ID = 10
;

If the structures are the same. How can I do this in MYSQL? My Editor gave me an sytanx-error.

Thx 4 your answers!

Greetz

A: 

Mysql does not use the values keyword:

Insert into table_a (field1, field2)
 Select field1, field2 from table_b where table_b.ID = 10;
kalengi
MySQL does use the values keyword
James
@JamesGoodwin the values keyword is not applicable since the values list is replaced by the select statement.
kalengi
A: 

In oracle and mysql:

insert into test 
select 1 from dual

Not: "insert into table values"

xt.and.r