Estimados.
Genero siguiente consulta, y me dice que la clausula GROUP BY falta o no es valida…
Select CRS_TBL_CAB_FACTURA.Comp,CRS_TBL_CAB_FACTURA.TIPO,CRS_TBL_CAB_FACTURA.FECHA,CRS_TBL_CAB_FACTURA.VTO,CRS_TBL_CAB_FACTURA.NUMERO,;
CRS_TBL_CAB_FACTURA.CODIGO_CLIENTE,CRS_TBL_CAB_FACTURA.VENDEDOR,CRS_TBL_CAB_FACTURA.CLIENTE,;
IIF( Inlist(Comp,"FV","DI","CH","IN","RP"),SALDO,-SALDO) As SALDO,;
IIF( Inlist(Comp,"FV","DI","CH","IN","RP"),IMPORTE,-IMPORTE) As IMPORTE;
FROM CRS_TBL_CAB_FACTURA;
where exist(select codigo FROM crs_clientes);
ORDER By CRS_TBL_CAB_FACTURA.CLIENTE,CRS_TBL_CAB_FACTURA.FECHA;
GROUP BY CRS_TBL_CAB_FACTURA.CLIENTE;
into Cursor Resumen
que estoy haciendo mal?
Diego A. Callegari
Select CRS_TBL_CAB_FACTURA.Comp,CRS_TBL_CAB_FACTURA.TIPO,CRS_TBL_CAB_FACTURA.FECHA,CRS_TBL_CAB_FACTURA.VTO,CRS_TBL_CAB_FACTURA.NUMERO,;
CRS_TBL_CAB_FACTURA.CODIGO_CLIENTE,CRS_TBL_CAB_FACTURA.VENDEDOR,CRS_TBL_CAB_FACTURA.CLIENTE,;
IIF( Inlist(Comp,"FV","DI","CH","IN","RP"),SALDO,-SALDO) As SALDO,;
IIF( Inlist(Comp,"FV","DI","CH","IN","RP"),IMPORTE,-IMPORTE) As IMPORTE;
FROM CRS_TBL_CAB_FACTURA;
where exist(select codigo FROM crs_clientes);
ORDER By CRS_TBL_CAB_FACTURA.CLIENTE,CRS_TBL_CAB_FACTURA.FECHA;
into Cursor Resumen
El GROUP BY es generalmente cuando hagas cálculos de SUMA, y en el GROUP BY tienen que ir todos los campos que no participan en el calculo, por ejemplo :
Select CRS_TBL_CAB_FACTURA.Comp,CRS_TBL_CAB_FACTURA.TIPO,CRS_TBL_CAB_FACTURA.FECHA,CRS_TBL_CAB_FACTURA.VTO,CRS_TBL_CAB_FACTURA.NUMERO,;
CRS_TBL_CAB_FACTURA.CODIGO_CLIENTE,CRS_TBL_CAB_FACTURA.VENDEDOR,CRS_TBL_CAB_FACTURA.CLIENTE,;
SUM(IIF( Inlist(Comp,"FV","DI","CH","IN","RP"),SALDO,-SALDO)) As SALDO,;
SUM(IIF( Inlist(Comp,"FV","DI","CH","IN","RP"),IMPORTE,-IMPORTE)) As IMPORTE;
FROM CRS_TBL_CAB_FACTURA;
where exist(select codigo FROM crs_clientes);
ORDER By CRS_TBL_CAB_FACTURA.CLIENTE,CRS_TBL_CAB_FACTURA.FECHA;
GROUP BY CRS_TBL_CAB_FACTURA.Comp,CRS_TBL_CAB_FACTURA.TIPO,CRS_TBL_CAB_FACTURA.FECHA,CRS_TBL_CAB_FACTURA.VTO,CRS_TBL_CAB_FACTURA.NUMERO,;
CRS_TBL_CAB_FACTURA.CODIGO_CLIENTE,CRS_TBL_CAB_FACTURA.VENDEDOR,CRS_TBL_CAB_FACTURA.CLIENTE
into Cursor Resumen
MK
Gracias a todos, funciono la solucion de Lewis
Diego A. Callegari