Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

Subquery returned more than 1 value

INSERT INTO information
SELECT
(SELECT productid from products where productid = 149880 ),
(select internalsku from products where productid IN (select productid from orderitems left join orders on orderitems.orderid = orders.orderid where orderitems.orderid > '7000149' )),
(SELECT orderid from orders where orderid = 7000149 )
select * from information


Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

(20 row(s) affected)
ASKER CERTIFIED SOLUTION
Avatar of Jon500
Jon500
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chapmandew
you can't run inserts in such a way....do your records (columns) relate to each other?
INSERT INTO information
SELECT  p.productid ,p.internalsku , i.orderid
from products p
inner join orderitems i on  p.productid = i.productid
inner join orders o on o.orderid = i.orderid
where i.orderid > '7000149' and p.productid = 149880
Avatar of rgb192

ASKER

> =