Ver Mensaje Individual
  #5  
Antiguo 06-12-2012
celades1 celades1 is offline
Miembro
 
Registrado: ago 2005
Posts: 116
Reputación: 19
celades1 Va por buen camino
Hola

creo que seria esto

Código SQL [-]
select a.descripcio,a.codigo,max(a.fecha),
avg((select a.precio from lineas where codigo=a.codigo and cliente=:cliente 
and fecha=(select max(fecha) from lineas where codigo=a.codigo and cliente=:cliente))) 
from lineas a 
where a.cliente=:cliente
group by a.descripcio,a.codigo

Panta
Responder Con Cita