Boa tarde pessoal.

Queria saber se é possível e como fazer para trazer os últimos N registros
em um select.
Por exemplo:

ITEM                    COR             VENDA
CAMISA          AZUL            09/07/2012 17:37
CAMISA          AZUL            13/07/2012 08:57
CAMISA          AZUL            19/07/2012 14:33
CAMISA          AZUL            25/07/2012 08:05
CAMISA          AMARELA         02/08/2012 11:12
CAMISA          VERDE           06/07/2012 09:27
CAMISA          VERDE           13/07/2012 07:06
CAMISA          VERDE           13/07/2012 19:19
CAMISA          VERDE           18/07/2012 06:25
CAMISA          VERDE           01/08/2012 19:10
CALCA           VERMELHA                30/07/2012 22:55
CALCA           VERMELHA                03/08/2012 19:12
CAMISA          PRETA           03/07/2012 18:06
CAMISA          PRETA           13/07/2012 07:06
CAMISA          PRETA           16/07/2012 08:31
CAMISA          PRETA           19/07/2012 17:27
CAMISA          PRETA           31/07/2012 17:06
CALCA           BRANCA          05/07/2012 18:04
CALCA           BRANCA          06/07/2012 19:25
CALCA           BRANCA          13/07/2012 19:22
CALCA           BRANCA          19/07/2012 06:37
CALCA           BRANCA          19/07/2012 09:13
CALCA           BRANCA          19/07/2012 17:20



Queria saber como trazer apenas as ultimas 3 vendas (claro q se um item não
teve 3 vendas só vai trazer a quantidade que teve) de cada item-cor.

Isso é possível ?

Obrigado!



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/Ultimos-N-Registros-de-cada-item-tp5719120.html
Sent from the PostgreSQL - Brasil mailing list archive at Nabble.com.
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a