That's not how
GROUP BY
works; you're grouping by
every column, so unless there are two identical records in the table, it will return every record.
Probably the simplest option would be to use
ROW_NUMBER
to partition the records:
WITH cte As
(
SELECT
InspNo,
InputStr,
PartnerCode,
CreaOn,
IsPush,
PushToPartner,
ROW_NUMBER() OVER (PARTITION BY PartnerCode ORDER BY CreaOn DESC) As RN
FROM
PartnerIntegrationLog
WHERE
IsPush Is Null
And
(PartnerCode = 'ADR' OR PartnerCode = 'MFC')
)
SELECT
InspNo,
InputStr,
PartnerCode,
CreaOn,
IsPush,
PushToPartner
FROM
cte
WHERE
RN = 1
;