I have a query that's intended to update a field named Last_Click_Date
based on the most recent EventDate from the _Click data view.
It doesn't appear to be grabbing the most recent date param and appending the subscriber record in the marketing data extension.
Here's query -- wondering why it would essentially be pulling a non-most recent click date:
SELECT de1.*
FROM (SELECT
S.SubscriberKey
, S.EmailAddress as 'email'
/*, S.Status*/
, Max(cast(C.EventDate as DateTime)) AS 'last_click_date'
, ROW_NUMBER() OVER (PARTITION BY
S.SubscriberKey
ORDER BY S._CustomObjectKey DESC) rn
FROM [Subscribers Data View] S
INNER JOIN [Click Data View] C WITH (NOLOCK)
on S.SubscriberKey = C.SubscriberKey
GROUP BY S._CustomObjectKey, S.SubscriberKey, S.EmailAddress, S.Status, C.EventDate
) de1
WHERE de1.rn = 1
cast(Max(C.EventDate) as DateTime)
as I believe the other way is not grabbing just the max date from the DV, but is instead the max of the cast value - of which there is only a single date value to see the 'max' of.