Ver Mensaje Individual
  #3  
Antiguo 27-07-2013
pame pame is offline
Registrado
NULL
 
Registrado: jul 2013
Posts: 6
Reputación: 0
pame Va por buen camino
mostrar varios registros !!!

bueno este es el codigo que utilizo y el error dice: error de sintaxis cerca de ff
Código SQL [-]
SELECT DISTINCT a.cod_producto,p.nombre,sum(a.cantidad)/ (date_part('DAY', TIMESTAMP ff- fi) )  as demanda,

   (150*sum(a.cantidad)/ (date_part('DAY', TIMESTAMP ff- fi) ))/(p.precio_unid * 0.13) as Q ,

   (sum(a.cantidad)/ (date_part('DAY', TIMESTAMP ff-fi) ))/(150*sum(a.cantidad)/ (date_part('DAY', TIMESTAMP ff- fi) ))/(p.precio_unid * 0.13) as N,

   (150*sum(a.cantidad)/ (date_part('DAY', TIMESTAMP ff- fi) ))/(p.precio_unid * 0.13)/(sum(a.cantidad)/ (date_part('DAY', TIMESTAMP ff- fi) )) as T,

   Stddev(a.cantidad)* sqrt(4) as Desv ,

   (Stddev(a.cantidad)* sqrt(4))*1.28 as IS,

   sum(a.cantidad)/ (date_part('DAY', TIMESTAMP ff- fi) )*4*((Stddev(a.cantidad)* sqrt(4))*1.28) as R

   FROM detalle_venta a, factura_vent fv,producto p

   WHERE(( p.cod_producto=a.cod_producto) and (a.cod_fact_vent=fv.cod_fact_vent) and  (fv.fecha between :fi and :ff)  )
       
  group by a.cod_producto,p.nombre,p.precio_unid
Responder Con Cita