sql where last 12 months
select Dateadd(Month, -12, GETDATE())
sql get latest of 2 datetimes
SELECT ID,
CASE WHEN
COALESCE(Date1, '1/1/1973') > COALESCE(Date2, '1/1/1973') -- COALESCE is to ensure comparison works when 1 is nullable
THEN Date1
ELSE Date2
END AS MostRecentDate
FROM Table
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us