views:

44

answers:

1
UPDATE
            MRT

SET 
             Date = MR.Date

FROM
             MRT
             JOIN MR on MR.SKU = MRT.SKU

HERE Is where i would like to do an order by min(mr.Date)

All I get is an incorrect Syntax error.

I have to set the date = the smallest mr.date

+3  A: 
UPDATE MRT SET Date = (SELECT min(Date) FROM MR WHERE MR.SKU = MRT.SKU);
ar
right but that will only return one date for all sku's
wil
No it sets the Date field in each row of MRT to the minimum Date from MR where the SKU fields are the same.
ar
hmm, its showing the same date for 50000 sku's
wil
You need a WHERE clause to select which records need updating
smirkingman

related questions