select com campos em colunas diferentes

Delphi

17/04/2006

bom dia pessoa.... eu estou usando delphi 7 com Firebird 1.5

tenho uma tabela de vendedores, e uma tabela de vendas, eu preciso fazer ume select que me traga isso..

VENDEDOR TOTAL DE VENDAS VENDAS REALIZADAS
RAFAEL 10 6
ROGERIO 7 3

a coluna TOTALDEVENDAS e VENDASREALIZADAS são de um mesmo campo, como faço para mostrar isso em colunas diferentes, igual eu fiz em cima?


Rafael Santana

Rafael Santana

Curtidas 0

Respostas

Motta

Motta

17/04/2006

Algo assim :

SELECT VENDEDOR.NOME_VENDEDOR,COUNT(VENDAS.VALOR) QTD_VENDAS,
            SUM(VENDAS.VALOR) TOTAL_VENDA
FROM VENDEDOR,VENDAS
WHERE VENDEDOR.COD = VENDA.COD
GROUP BY VENDEDOR.NOME_VENDEDOR


Pelo que entendi se quer qtd de vendas e total ($) delas, não ?


GOSTEI 0
Rafael Santana

Rafael Santana

17/04/2006

valeu, amigo...mas já consegui...fiz STORED PROCEDURE DELAS...

obrigado


GOSTEI 0
POSTAR