[RESOLVIDO]Ajuda com SQL ( Oracle )

1 resposta
P

Fala feras :smiley:

Montei uma query recursiva e eu precisava adicionar alguns parâmetros na condição where, mas não to conseguindo e nem sei se consigo fazer isso nessa clausula pq meu conhecimento com SQL é bem limitado :smiley:

A query original é:

select distinct rq_req_status,  count(*)
from telefonica_cdb_db.req start with rq_father_id = 6
connect by prior rq_req_id = rq_father_id 
group by rq_req_status

E eu gostaria de modifica-la para

select distinct rq_req_status,  count(*)
from req start with rq_father_id = 6
connect by prior rq_req_id = rq_father_id where rq_no_of_sons != 0
group by rq_req_status

O que estou fazendo errado? É permitido fazer isso?

1 Resposta

P

Resolvido:

select distinct rq_req_status,  count(*)
from req 
where rq_no_of_sons != 0
start with rq_father_id = 5
connect by prior rq_req_id = rq_father_id
group by rq_req_status
Criado 15 de maio de 2009
Ultima resposta 15 de mai. de 2009
Respostas 1
Participantes 1