我試圖插入值到選定的表中的列,但只插入MySQL語句的結果。 select語句本身正確工作並返回結果。MySQL插入語句(插入到表(列)選擇語句)
當用INSERT語句是合併失敗,
error incorrect syntax near `dedspgoods`.`case number`.
誰能幫助我正確的語法?我erronous語法如下:
insert into despgoods_alldetails
(`case number`, weight, customer, transporttypename)
values
(select despgoods.`case number`
, despgoods.weight
, despgoods.customer
, customers.transporttypename
from despgoods
inner join customers
on despgoods.customer = customers.customer)
:
,如果你要插入的結果集的
SELECT
的那麼試試這個(通知沒有VALUES
條款SELECT的作用是什麼? –作品的選擇是: – Smudger
選擇'despgoods'.case編號,'despgoods'.'weight','despgoods'.'c ustomer','customers'.'transporttypename' from despgoods inner join customers on despgoods.'customer' ='customers'.'customer') – Smudger