0

Hi,

INSERT INTO table1 (supid, paid)
VALUES ( (SELECT supid FROM def_1 WHERE id IN (SELECT id FROM def_2)),
(SELECT paid FROM def_1 WHERE id IN (SELECT id FROM def_2))

This code returns more than 1 value, teherefore i can not execute it. Is there any other way to do it?

Thanks

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by tesuji
0

Hi veledrom,

I think your SQL is syntactically not corret: If insert is done from result set given by select you must not use values part. Also, if you want to insert two values you must also select two values in each row. So try this:

INSERT INTO table1 (subid, paid)
 SELECT subid, paid FROM def_1 WHERE id IN (SELECT id FROM def_2)

krs,
tesu

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.