Reputation: 254
guys im trying to insert into a table with multiple value.
i want insert into purchasing table where customerID is gained from Customer table and the SourceID is always 1 because it its default. i try query like this
insert into purchasing (customerID,SourceID) select customerID from Customer where ************,'1'
but it returns erorr, can u guys help me, how to insert into table with multiple select and default insert
note: ******* is any condition
Upvotes: 0
Views: 177
Reputation: 627
It is due to you have couple of errors in your sql. 1. You have the closing ) but never opened it. 2. Include the default value in your query
insert into purchasing (customerID,SourceID) select customerID, 1 from Customer where ???
Upvotes: 1
Reputation: 745
You are writing wrong sql query syntax. Your sql query should be something like:
insert into purchasing (customerID,SourceID) select customerID, 1 from Customer where ***
Upvotes: 4