count adding up and presented

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Mon, 26 Nov 2007 8:12 am

Hello I wanted to sasber how do I get a select do everything that is necessary and then bring only the sum on one line example name, end, sales add up all those sales and return stay so carlos 110 sales
carlos12
Location: rio

Poston Mon, 26 Nov 2007 8:26 am

Hey Carlos, beleza?

so, to know how to do that you must first tell us what would be the \"do everything that is necessary\" , because the way to make changes as the result that you need.

[] 's
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Mon, 26 Nov 2007 10:15 am

for example I want to catch the anco all the people who are with the CPF registered as 00000000000 and also want to get dodos that are with the CPf in white, with the name of his mother as Mary samineni and with his mother's name blank and wanted the result like this: cpf cpf as 280 000000000 white 100 MSA name mahapatra sauro: 240 blank 5 mother's name _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ I have the select separate but wanted to join a file only
carlos12
Location: rio

Poston Mon, 26 Nov 2007 10:37 am

Hey carlos, beleza?

man, follows one example,
Code: Select all
SQL> SELECT DESCRICAO FROM MENS_ERRO
  2  /

DESCRICAO
-------------------------
JOSE


JOSE
JOSE
MARIA

0000000
0000000
JOSE
JOSEFINA

11 rows selected.

SQL> SELECT COUNT(1),
  2         DESCRICAO
  3    FROM mens_erro
  4    GROUP BY DESCRICAO
  5    HAVING COUNT(1)>1
  6  /

COUNT(1) DESCRICAO
--------- -------------------------
        4 JOSE
        3
        2 0000000

SQL>
in the second select used the having, in this case he's filtering only those records that have more than one occurrence.

[] 's
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Mon, 26 Nov 2007 11:51 am

valeu guy you are the best
carlos12
Location: rio

Poston Wed, 28 Nov 2007 12:39 pm

SELECT a. cpf_zero, a. cpf_nulo, a. nome_fixo, nome_nulo FROM (SELECT COUNT (*) FROM table WHERE SSN = 00000000000) cpf_zero, (SELECT COUNT (*) FROM table WHERE SSN IS NULL) cpf_nulo, (SELECT COUNT (*) FROM table WHERE nom_mae = ' maria samineni ') nome_fixo, (SELECT COUNT (*) FROM table WHERE nom_mae IS NULL) nome_nulo;
bertosro
Location: São Paulo - SP

Bertosro
MSN / TALK - roberto.fernandes@gmail.com



Return to SQL

Who is online

Users browsing this forum: No registered users and 2 guests