Contagem de registros

"Eduardo Oliveira silva" <[email protected]>
Newsgroups gmane.comp.db.bancosdedados
Message-ID <[email protected]>
Boa tarde pessoal,

Estou com o seguinte problema aqui.

tenho duas tabelas relacionadas com 1 para muitos
EX:

   Tabela1               tabela 2
   Codigotab1          Codigotab2
   Numero               Numero.serial
                               CodigoTab1

quando faço o select.
SELECT Tabela1.codigotab1, Tabela1.numeroD, Tabela2.codigotab2,
Tabela2.NumeroSerial
FROM Tabela1 INNER JOIN Tabela2 ON Tabela1.codigotab1 = Tabela2.codigotab1;

Ele me traz

Codigotab1           numeroD        codigotab2               numero serial
-----------------------------------------------------------------------------------------
01                             123.1                 01
         987.78
01                               63.7                 02
          897.88
01                               78.9                 03
          767.98
02                               67.9                 04
          877.99
02                               98.8                 05
          876.65


Em fim, eu preciso gerar uma nova coluna onde númere as linha de cada
Codigotab1.

Codigotab1           numeroD        codigotab2               numero
serial            numeração
-----------------------------------------------------------------------------------------------------------------
01                             123.1                 01
         987.78                           1
01                               63.7                 02
          897.88                           2
01                               78.9                 03
          767.98                           3
02                               67.9                 04
          877.99                           1
02                               98.8                 05
          876.65                           2

-- 
Eduardo de Oliveira
Fone: 8448-4117
msn: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.