0

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

3 Answers 3

4

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 *** 
Sign up to request clarification or add additional context in comments.

1 Comment

if on case after select customerID i need to select SourceID from another table, can i put select customerid,(select ****** where **** ) where ***** ?
1

Try select customerID, 1 from Customer

Comments

1

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 ???

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.