简体   繁体   中英

single-row subquery returns more than one row

I am getting the following error : "single-row subquery returns more than one row"while trying to execute the following query :

select * 
from wm_inventory 
where item_id =(select item_cbo.item.id  
                from item_cbo 
                where item_name in ('564310','140270'));

Change to this:

select * 
from wm_inventory 
where item_id   in  (select item_cbo.item.id  
                from item_cbo 
                where item_name in ('564310','140270'));

You can't return multiple rows for an "=" operator.

The error is pretty obvious. Use in :

select i.* 
from wm_inventory i 
where i.item_id in (select item_cbo.item.id  
                    from item_cbo 
                    where item_name in ('564310', '140270')
                   );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM