insert into *() select A.xxx,B.xxxx,C.xxx from A,B,C where A.id=B.id and B.id=C.id
参考下: insert into store_inventory (toy_id,store_id,inventory) select toy_id,store_id,inventory from (select toy_id , @i:=@i+1 as id from toy_info,(select @i:=0) as temp ) as a inner join (select store_id , @i:=@i+1 as id from store_info,(select @i:=0) as temp ) as b on a.id=b.id inner join (select inventory , @i:=@i+1 as id from temp_1,(select @i:=0) as temp ) as c on b.id=c.id
卡在这一步了
基本搞定了
怎么样可以一次插三个select啊
select A.xxx,B.xxxx,C.xxx
from A,B,C
where A.id=B.id and B.id=C.id
insert into store_inventory (toy_id,store_id,inventory) select toy_id,store_id,inventory from
(select toy_id , @i:=@i+1 as id from toy_info,(select @i:=0) as temp ) as a
inner join
(select store_id , @i:=@i+1 as id from store_info,(select @i:=0) as temp ) as b
on a.id=b.id inner join
(select inventory , @i:=@i+1 as id from temp_1,(select @i:=0) as temp ) as c
on b.id=c.id