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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.