Hi everybody,

I have two tables, Stock and Stockitemlist, am trying to update Itemcost in stockItemlist from Stock with the below query,

Update StockItemList set ItemCost =(select ItemCost ItemCost from Stock where ItemMasterUID in (select ItemMasterUID from StockItemList))

but am getting an error messsage like :

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.

Can any body please tell me how to update,

Member Avatar for Member #804923

Please execute the query

select ItemCost ItemCost from Stock where ItemMasterUID in (select ItemMasterUID from StockItemList).

This query will return more than one row. As a result you cannot use the update statement with this sub query.

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.