The query below brings up a set of data below that. All items are valued at $9.99. If a row has any information in the column "ShadowOf", I want to update that row. It should take the price from the row where the contents of shadowof appear & add 2%. To give an example 'GreenApples' is a shadow of 'BoxOfApples'. 'BoxOfApples' is valued at $9.99, so I want to make 'GreenApples' $10.19. How would I do this?I've attempted with a similar query, but the problem with my previous query is that it only affects the first Shadow. Each additional shadow is ignored. [url=http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=189733]That post can be found here[/url] Thanks!DECLARE @tmpTable TABLE(ID NVARCHAR(50), BuyDotComPrice DECIMAL(18,2), ShadowOf NVARCHAR(50), CompanyID INT);INSERT INTO @tmpTable VALUES('BoxOfApples', 9.99, '', 344),('GreenApples', 9.99, 'BoxOfApples', 344),('GalaApples', 9.99, 'BoxOfApples', 344),('CaseOfSoda', 9.99, '12Sodas', 344),('12Sodas', 9.99, '', 344),('PackageOfSoda', 9.99, '12Sodas', 344);SELECT ID,BuyDotComPrice, ShadowOf, CompanyID FROM @tmpTable
ID BuyDotComPrice ShadowOf CompanyIDBoxOfApples 9.99 344GreenApples 9.99 BoxOfApples 344GalaApples 9.99 BoxOfApples 344CaseOfSoda 9.99 12Sodas 34412Sodas 9.99 344PackageOfSoda 9.99 12Sodas 344
-SergioI use Microsoft SQL 2008