on 10-12-2010 7:08 PM
les comento que estoy realizando un query para clientes, la idea es que me muestre la ultima factura comprada por cada cliente, intente haciendolo con la funcioon TOP, de la siguiente manera.
SELECT TOP 1 T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName FROM OINV T0 ORDER BY T0.DocNum DESC
Pero la funcion TOP solo me muestra la ultima factura.
No se si me puedan recomendar alguna funcion con el cual pueda traer esta informacion.
Salu2.
Necesitas utilizar la funcion MAX (docnum), de esta forma debe traerte la ultima factura
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Mauricio gracias por tu pronta respuesta.
Solo que al utilizar esta funcion al igual solo me trae un unico registro de factura, el objetivo del query, es que me arroje un listado de todos los clientes la ultima factura registrada.
"CLIENTE A" "01/01/2009" "FACT1"
"CLIENTE B" "01/05/2009" "FACT23"
"CLIENTE C" "30/05/2010" "FACT85"
GRACIAS Y SALUDOS.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.