I have this query
SELECT
sa.MSISDN,
MIN(sa.DateRegistered) AS firstReg,
s.DateRegistered AS currentReg,
MAX(sa.DateRegistered) AS previousReg
FROM
sms.dbo.SubscriptionsArchive sa
INNER JOIN
sms.dbo.Subscriptions s ON sa.MSISDN = s.MSISDN
GROUP BY
sa.MSISDN
And its wrong as s.DateRegistered is not used in aggregate function and it is not used in group by.
How do I correct this query?