1

I want to insert multiple row using one insert sql query. I know it is possible to insert multiple row in one sql query.

I have written some query as
insert into test values ((select loan_id from loan_transaction_mcg))

but I received the error
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Is there anyway to insert data like this way. I have single column in test table.

1
  • 1
    Note that the manual page mentions the corresponding syntax (INSERT ... SELECT) and has examples too. Commented Jul 30, 2012 at 12:05

1 Answer 1

2

Assuming your test table is already created and contains only a loan_id, all you have to do is drop values and remove the now redundant parentheses.

INSERT INTO test SELECT loan_id FROM loan_transaction_mcg
Sign up to request clarification or add additional context in comments.

2 Comments

why i have to remove parenthesis. i am confused on this.
@Dinupkandel - You don't actually have to but they are redundant. I'll edit the answer to better reflect that.

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.