Código PHP:
$sql = "SELECT p.testdim,, p.milk, p.fat,p.scc,p.prot,p.herd_id, h.herd_id,h.codi,a.herd_id,a.parity,a.endparitydate
FROM production p , herd h, ag_parity a
WHERE and p.herd_id= a.herd_id
and a.herd_id= h.herd_id
and p.herd_id= h.herd_id
group by p.testdate
LIMIT 0, 50";
graciasv :P