Fórum Somar dados #166815
28/06/2003
0
Ola pessoal !!!!
Alguém sabe como somar dados de uma tabela???
Tipo assim no meu programa de cadastro há uma formulario e nele há um button ao clicar no buton e este deve me trazer o total de clientes homesns que tenho e ao clicar e em outro buton o mesmop deve trazer o total de clientes mulhres que tenho.
Agradeço a todos ...
[andy]
Alguém sabe como somar dados de uma tabela???
Tipo assim no meu programa de cadastro há uma formulario e nele há um button ao clicar no buton e este deve me trazer o total de clientes homesns que tenho e ao clicar e em outro buton o mesmop deve trazer o total de clientes mulhres que tenho.
Agradeço a todos ...
[andy]
Andy
Curtir tópico
+ 0
Responder
Posts
28/06/2003
Wallacest
bem, imagino que tenha um campo chamado Sexo ou coisa parecida
Vc pode pediar para ele percorrer a tabela procurando
Tipo
Var Mulher, Homem : Integer
While not TCliente.eof Do
Begin
If TClienteSexo.AsString = ´M´ Then
Begin
Homem := Homem + 1;
End;
If TClienteSexo.AsString = ´F´ Then
Begin
Mulher := Mulher + 1;
End;
TCLiente.next
end;
ShowMessage (´´+Homem+´ Homens´#10´´+Mulher+´ Mulheres)´);
end;
Essa rotina é para BD PARADOX usando Componente TABLE, tb pode usar SQL, ai é outro caso, mais é facil tb.
Qualquer duvida
Acho que isso pode t ajudar
Vc pode pediar para ele percorrer a tabela procurando
Tipo
Var Mulher, Homem : Integer
While not TCliente.eof Do
Begin
If TClienteSexo.AsString = ´M´ Then
Begin
Homem := Homem + 1;
End;
If TClienteSexo.AsString = ´F´ Then
Begin
Mulher := Mulher + 1;
End;
TCLiente.next
end;
ShowMessage (´´+Homem+´ Homens´#10´´+Mulher+´ Mulheres)´);
end;
Essa rotina é para BD PARADOX usando Componente TABLE, tb pode usar SQL, ai é outro caso, mais é facil tb.
Qualquer duvida
Acho que isso pode t ajudar
Responder
Gostei + 0
28/06/2003
Wallacest
bem, imagino que tenha um campo chamado Sexo ou coisa parecida
Vc pode pediar para ele percorrer a tabela procurando
Tipo
Var Mulher, Homem : Integer
While not TCliente.eof Do
Begin
If TClienteSexo.AsString = ´M´ Then
Begin
Homem := Homem + 1;
End;
If TClienteSexo.AsString = ´F´ Then
Begin
Mulher := Mulher + 1;
End;
TCLiente.next
end;
ShowMessage (´´+Homem+´ Homens´#10´´+Mulher+´ Mulheres)´);
end;
Essa rotina é para BD PARADOX usando Componente TABLE, tb pode usar SQL, ai é outro caso, mais é facil tb.
Qualquer duvida
Acho que isso pode t ajudar
Vc pode pediar para ele percorrer a tabela procurando
Tipo
Var Mulher, Homem : Integer
While not TCliente.eof Do
Begin
If TClienteSexo.AsString = ´M´ Then
Begin
Homem := Homem + 1;
End;
If TClienteSexo.AsString = ´F´ Then
Begin
Mulher := Mulher + 1;
End;
TCLiente.next
end;
ShowMessage (´´+Homem+´ Homens´#10´´+Mulher+´ Mulheres)´);
end;
Essa rotina é para BD PARADOX usando Componente TABLE, tb pode usar SQL, ai é outro caso, mais é facil tb.
Qualquer duvida
Acho que isso pode t ajudar
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)