Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rlull
Starting Member
39 Posts |
Posted - 2006-05-25 : 10:38:49
|
| I have a Cart table and an OrderItems table. I need to update multiple rows in the OrderItems table based on the Product IDs in the Cart. I know I am close but haven't quite got it. Using the following SQL I am able to update a single row but if multiple products exist in the Cart, it errs out because the subquery finds multiple records. Thanks for any help.(@CartID char(36), @OriginalOrderID int)/* Update order items */update OrderItemsset BackOrdered = 0, BOShipped = 1, BOShipDate = GetDate(), BackOrderID = OrderIDwhere OrderID = @OriginalOrderIDand ProdID = (select ProdID from Cart where CartID = @CartID) |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-05-25 : 14:06:03
|
| ProdID IN (select ProdID from Cart where CartID = @CartID)Tara Kizeraka tduggan |
 |
|
|
rlull
Starting Member
39 Posts |
Posted - 2006-05-25 : 14:41:59
|
| Worked perfectly, thanks! |
 |
|
|
|
|
|