How to return a unique record

Solution 1:

You can inner join to a table with max creation_date per secondaryid to ensure you have only latest creation_date

SELECT DISTINCT *
FROM PRIMARY
JOIN SECONDARY ON PRIMARY.SECONDARYID = SECONDARY.ID
inner join (
  select 
  secondaryid
  , max(creationdate) maxdate 
  from PRIMARY 
  group by secondaryid) mx 
on PRIMARY.seconardyid = mx.secondaryid and mx.maxdate = PRIMARY.creationdate 
WHERE PRIMARY.CREATIONDATE BETWEEN (NOW() - INTERVAL 14 DAY) AND NOW()