PeterMatthews
asked on
TSQL Update on same table selecting TopX recs from subquery but ALL records updating.
Why does the following TSQL resulits in all records being updated not Top 70. Thanks
Update Tbl_Stock_Take_Item
Set Page_Num = @Page_Count
where exists
(Select Top 70 Tbl_Stock_Take_Item_Id
From Tbl_Stock_Take_Item as Tabtwo
Where Tbl_Stock_Take_Item.Tbl_St ock_Take_I tem_Id = Tabtwo.Tbl_Stock_Take_Item _Id
Order By Tabtwo.Location asc)
Update Tbl_Stock_Take_Item
Set Page_Num = @Page_Count
where exists
(Select Top 70 Tbl_Stock_Take_Item_Id
From Tbl_Stock_Take_Item as Tabtwo
Where Tbl_Stock_Take_Item.Tbl_St
Order By Tabtwo.Location asc)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.