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 |
SergioM
Posting Yak Master
170 Posts |
Posted - 2013-08-13 : 15:53:22
|
I'm so close, but I just don't have it. I received this good advice about updating one row, based on a different row's price (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=187393)My dataset looks like this:ID BuyDotComPrice CompanyID ShadowOfAB CIRCLE PRO 199.99 203 AB CIRCLE PRO-b2 199.99 203 AB CIRCLE PROAB CIRCLE PRO-TB 249.99 344 AB CIRCLE PROAB CIRCLE PRO-TB-S1 0 344 AB CIRCLE PRO I need to update the price of an item where the CompanyID is 344 and the ShadowOf is not null. The value in ShadowOf is the same as the ID that I want to get the BuyDotComPrice for. It should be simple, but I keep getting errors.-SergioI use Microsoft SQL 2008 |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-08-13 : 15:57:34
|
Post the query you currently have even if is not working right or giving you an error. From your description, it looks like you will need a where clause something like shown below.....WHERE CompanyID=344 AND ShadowOf IS NOT NULL However, that will update two rows in your example. If you want to update only one of those rows, you have to have some rule to determine which of those you want to update. |
|
|
|
|
|