CASE WHEN max(c.Client_Changed)> max(m.tlog_date)
THEN CASE WHEN max(c.Client_Changed) > max(t.transactionpurchasedate)
THEN max(c.Client_Changed)
ELSE max(t.transactionpurchasedate)
END
ELSE CASE WHEN max(m.tlog_date) > max(t.transactionpurchasedate)
THEN max(m.tlog_date)
ELSE max(t.transactionpurchasedate)
END
END

CASE WHEN max(COALESCE(c.Client_Changed,'17530101'))> max(COALESCE(m.tlog_date,'17530101'))
THEN CASE WHEN max(COALESCE(c.Client_Changed,'17530101')) > max(COALESCE(t.transactionpurchasedate,'17530101'))
THEN max(c.Client_Changed)
ELSE max(t.transactionpurchasedate)
END
ELSE CASE WHEN max(COALESCE(m.tlog_date,'17530101')) > max(COALESCE(t.transactionpurchasedate,'17530101'))
THEN max(m.tlog_date)
ELSE max(t.transactionpurchasedate)
END
END