Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/10/2008, 13:43
bellleti
 
Fecha de Ingreso: abril-2008
Mensajes: 144
Antigüedad: 16 años, 1 mes
Puntos: 1
Pregunta problem con max , group by

tengo esa consulta que me funciona bien, pero cuando le pongo el max i el group by me dice que no le gusta :(

Código PHP:

SELECT h
.codi,h.herd_id,p.testdim,p.testdatep.milkp.fat,p.scc,p.prot,p.herd_ida.herd_id,max(a.parity),a.endparitydate
                   FROM production p 
herd hag_parity a
                  WHERE p
.TESTDATE  '2008-05-07'
                 
and p.herd_ida.herd_id 
                 
and a.herd_idh.herd_id
                 
and p.herd_idh.herd_id
                 order by h
.codi
group by a
.herd_id
mensaje error:

Código PHP:
Error

consulta SQL
Documentación

SELECT h.codih.herd_idp.testdimp.testdatep.milkp.fatp.sccp.protp.herd_ida.herd_idmaxa.parity ) , a.endparitydate
FROM production p
herd hag_parity a
WHERE p
.TESTDATE '2008-05-07'
AND p.herd_id a.herd_id
AND a.herd_id h.herd_id
AND p.herd_id h.herd_id
ORDER BY h
.codi
GROUP BY a
.herd_id
LIMIT 0 
30

MySQL ha dicho
Documentación
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by a.herd_id
LIMIT 030 at line 1 
me pueden ayudar pk me pasa esto?

Última edición por bellleti; 28/10/2008 a las 13:43 Razón: cositas