table1 から table2 にデータを挿入し、自分のデータを 1 つの (同じ) クエリで table2 に挿入したいのですが、うまくいきません。これは私のクエリです
$query='insert into table2(id,name) values("001",select first_name from table1 where table1.id="001")';
私の質問のどこが間違っているのか誰か教えてください。とても喜んでいます。ありがとう。
insert into table2 (id, name)
select '001', first_name
from table1
where id = '001'
またはid
、それが001
insert into table2 (id, name)
select id, first_name
from table1
where id = '001'
insert into table2 (id, name)
select id, first_name from table1 where table1.id = '001';
^ なぜハードコードするのselect '001'
ですか?
insert into table2(id,name)
select "001",first_name from table1 where table1.id="001"