Viewing 5 posts - 1 through 5 (of 5 total)
DB Dan (4/13/2011)
UPDATE trans
SET price = CASEWHEN relatedID IS NOT NULL
THEN
(select avg(price) from trans where id<=t.relatedid)
ELSE
(select avg(price) from trans where id<=t.id)...
April 14, 2011 at 1:46 am
DB Dan (4/13/2011)
UPDATE trans
SET price = CASEWHEN relatedID IS NOT NULL
THEN
(select avg(price) from trans where id<=t.relatedid)
ELSE
(select avg(price) from trans where id<=t.id)...
April 13, 2011 at 12:35 pm
John Mitchell-245523 (4/13/2011)
;WITH t1 AS (SELECT id,price,relatedid FROM trans)
UPDATE trans
SET price=(
SELECT AVG(price)
FROM t1
WHERE t1.id<=trans.id
)
WHERE relatedid IS NULL
;WITH t1 AS (SELECT id,price,relatedid FROM...
April 13, 2011 at 12:30 pm
John Mitchell-245523 (4/13/2011)
Please will you post your actual update statement, since the one you posted has two syntax errors in it.Thanks
John
Thank u John... I just edited it a couple ago......
April 13, 2011 at 5:55 am
Manish_ (4/13/2011)
Update TempTrans
set price=(case when relatedid is...
April 13, 2011 at 5:51 am
Viewing 5 posts - 1 through 5 (of 5 total)