Friday, October 4, 2013

SQL - Update Table From Itself


UPDATE a
SET a.Price=(SELECT MAX(b.PRICE) FROM ITEM AS b WHERE b.Item=a.Item and b.Price is not null )
FROM  Item AS a 


*credit goes to this post: http://stackoverflow.com/questions/12151107/tsql-update-table-from-itself

No comments:

Post a Comment