[英]Insert into table With select and multiple value SQL server
伙計們即時通訊試圖插入到具有多個值的表。
我想插入到購買表中,其中從客戶表中獲得了客戶ID,並且源ID始終為1,因為它是默認值。 我嘗試這樣查詢
insert into purchasing (customerID,SourceID) select customerID from Customer where ************,'1'
但是它返回erorr,你們能幫我嗎,如何通過多次選擇和默認插入來插入表
注意: *******是任何條件
您正在編寫錯誤的sql查詢語法。 您的SQL查詢應該是這樣的:
insert into purchasing (customerID,SourceID) select customerID, 1 from Customer where ***
嘗試select customerID, 1 from Customer
這是由於您的sql中有幾個錯誤。 1.您已關閉),但從未打開過。 2.在查詢中包括默認值
insert into purchasing (customerID,SourceID) select customerID, 1 from Customer where ???
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.