Skip to main content
added 196 characters in body
Source Link
Rob Farley
  • 16.2k
  • 2
  • 39
  • 61
UPDATE T1 SET 
Opening_date = T2.Opening_date, 
ORDINAL = DATEDIFF(DAY, T2.Opening_Date, T1.DATE) 
FROM FactTransaction T1 
INNER JOIN DimStore T2 ON T1.cod_Store = T2.Cod_StoreKey;

...if I understand you correctly.

Edit: Ok, just go with:

UPDATE T1 SET 
ORDINAL = DATEDIFF(DAY, T2.Opening_Date, T1.DATE) 
FROM FactTransaction T1 
INNER JOIN DimStore T2 ON T1.cod_Store = T2.Cod_StoreKey;
UPDATE T1 SET 
Opening_date = T2.Opening_date, 
ORDINAL = DATEDIFF(DAY, T2.Opening_Date, T1.DATE) 
FROM FactTransaction T1 
INNER JOIN DimStore T2 ON T1.cod_Store = T2.Cod_StoreKey;

...if I understand you correctly.

UPDATE T1 SET 
Opening_date = T2.Opening_date, 
ORDINAL = DATEDIFF(DAY, T2.Opening_Date, T1.DATE) 
FROM FactTransaction T1 
INNER JOIN DimStore T2 ON T1.cod_Store = T2.Cod_StoreKey;

...if I understand you correctly.

Edit: Ok, just go with:

UPDATE T1 SET 
ORDINAL = DATEDIFF(DAY, T2.Opening_Date, T1.DATE) 
FROM FactTransaction T1 
INNER JOIN DimStore T2 ON T1.cod_Store = T2.Cod_StoreKey;
Source Link
Rob Farley
  • 16.2k
  • 2
  • 39
  • 61

UPDATE T1 SET 
Opening_date = T2.Opening_date, 
ORDINAL = DATEDIFF(DAY, T2.Opening_Date, T1.DATE) 
FROM FactTransaction T1 
INNER JOIN DimStore T2 ON T1.cod_Store = T2.Cod_StoreKey;

...if I understand you correctly.