Hope your well and can help me with a little problem i am encountering.
The query below compares the closed data in legacy vs closed date in current. What i have noticed is if the closed date is blank in both legacy and current then the ClosedMatch = False.
The ideal outcome would be ClosedMatch = True ( as both Columns are the same).
What else do i need to add to my statement below to get the correct outcome ?
LEGACY.DATE_CLOSED__C as LClosedDate,
CURRENT.DATE_CLOSED__C as ClosedDate,
Case when CURRENT.DATE_CLOSED__C = LEGACY.DATE_CLOSED__C Then 'True' ELSE 'False' END AS ClosedMatch
Inner join CURRENT
What you see as blanks may be NULLs. Try the following:
LEGACY.DATE_CLOSED__C AS LClosedDate,
CURRENT.DATE_CLOSED__C AS ClosedDate,
WHEN COALESCE(CURRENT.DATE_CLOSED__C,'19000101') = COALESCE(LEGACY.DATE_CLOSED__C,'19000101') THEN 'True'
END AS ClosedMatch
INNER JOIN [CURRENT]
You might have to tweak the query based on whether you have 1/1/1900 in any of the actual data.