SELECT p.field_name1,apply_to, period_id, pl.person_id, COUNT(*) as Total, periods.code
FROM period_liquidations pl
inner join persons p on pl.person_id = p.id
inner join periods on pl.period_id= periods.id
GROUP BY apply_to, period_id, person_id
HAVING COUNT(*) > 1;