- Posts: 20
- Thank you received: 0
Error in multinivel SQL Query
13 years 4 months ago #847
by acury
Error in multinivel SQL Query was created by acury
Hi,
I´m try execute a report (or query) in the ETL, but the return value not correct:
SELECT * FROM (
SELECT NOME_COMPLETO,NOME_TURMA,NRO_CHAMADA,Count(*) QTD FROM (
SELECT a.nome_completo,t.nome_turma,at.nro_chamada,
TO_CHAR(ocorrencia_comunicado.data, 'DD/MM/YYYY'), disciplinas.nome1_15,
professores.apelido, ocorrencia_tipo.descricao, ocorrencias.descricao,
ocorrencia_comunicado.descricao, ocorrencia_comunicado.cod_ocorrencia_comunicado
FROM
turmas t,aluno_turma AT, alunos a,ocorrencia_aluno oa,ocorrencia_comunicado, ocorrencia_tipo, ocorrencias, professores, disciplinas
WHERE
ocorrencia_comunicado.cod_ocorrencia_comunicado = oa.cod_ocorrencia_comunicado
AND a.cod_aluno = oa.cod_aluno
AND at.cod_aluno=a.cod_aluno
AND t.cod_turma=at.cod_turma
AND t.ano = 2010
AND AT.ano = 2010
AND ocorrencias.cod_ocorrencia = ocorrencia_comunicado.cod_ocorrencia
AND ocorrencia_tipo.cod_ocorrencia_tipo = ocorrencias.cod_ocorrencia_tipo
AND professores.cod_prof = ocorrencia_comunicado.cod_prof
AND disciplinas.cod_disc = ocorrencia_comunicado.cod_disc
AND ocorrencia_comunicado.data >='01/01/2010'
) GROUP BY NOME_COMPLETO,NOME_TURMA,NRO_CHAMADA
) WHERE QTD >=5 ORDER BY QTD DESC
The field QTD return a incorrect value, if run the query in the sqldeveloper, the result is correct, my database is Oracle 10g.
I´m try create one view, but the problem persist.
tanks
Tanks
I´m try execute a report (or query) in the ETL, but the return value not correct:
SELECT * FROM (
SELECT NOME_COMPLETO,NOME_TURMA,NRO_CHAMADA,Count(*) QTD FROM (
SELECT a.nome_completo,t.nome_turma,at.nro_chamada,
TO_CHAR(ocorrencia_comunicado.data, 'DD/MM/YYYY'), disciplinas.nome1_15,
professores.apelido, ocorrencia_tipo.descricao, ocorrencias.descricao,
ocorrencia_comunicado.descricao, ocorrencia_comunicado.cod_ocorrencia_comunicado
FROM
turmas t,aluno_turma AT, alunos a,ocorrencia_aluno oa,ocorrencia_comunicado, ocorrencia_tipo, ocorrencias, professores, disciplinas
WHERE
ocorrencia_comunicado.cod_ocorrencia_comunicado = oa.cod_ocorrencia_comunicado
AND a.cod_aluno = oa.cod_aluno
AND at.cod_aluno=a.cod_aluno
AND t.cod_turma=at.cod_turma
AND t.ano = 2010
AND AT.ano = 2010
AND ocorrencias.cod_ocorrencia = ocorrencia_comunicado.cod_ocorrencia
AND ocorrencia_tipo.cod_ocorrencia_tipo = ocorrencias.cod_ocorrencia_tipo
AND professores.cod_prof = ocorrencia_comunicado.cod_prof
AND disciplinas.cod_disc = ocorrencia_comunicado.cod_disc
AND ocorrencia_comunicado.data >='01/01/2010'
) GROUP BY NOME_COMPLETO,NOME_TURMA,NRO_CHAMADA
) WHERE QTD >=5 ORDER BY QTD DESC
The field QTD return a incorrect value, if run the query in the sqldeveloper, the result is correct, my database is Oracle 10g.
I´m try create one view, but the problem persist.
tanks
Tanks
Please Log in or Create an account to join the conversation.
13 years 4 months ago #849
by admin
Mike
ETL Architect
Replied by admin on topic Re:Error in multinivel SQL Query
I have never seen anything like this before
May be you are connected to two different databases?
Of different users?
Peter
May be you are connected to two different databases?
Of different users?
Peter
Mike
ETL Architect
Please Log in or Create an account to join the conversation.
13 years 4 months ago #850
by acury
Replied by acury on topic Re:Error in multinivel SQL Query
I also do not ...
No, all tables are in the same Oracle user, the only thing \"different\" in research is a SELECT inside another SELECT, doing research within the sqldeveloper totals are right, doing it within the ETL returns results with higher values ( for example, in sqldeveloper it returns 32 for a record, it returns the ETL 82!)
Can you do a test there with this kind of query?
Thanks
No, all tables are in the same Oracle user, the only thing \"different\" in research is a SELECT inside another SELECT, doing research within the sqldeveloper totals are right, doing it within the ETL returns results with higher values ( for example, in sqldeveloper it returns 32 for a record, it returns the ETL 82!)
Can you do a test there with this kind of query?
Thanks
Please Log in or Create an account to join the conversation.
13 years 4 months ago #851
by admin
Mike
ETL Architect
Replied by admin on topic Re:Error in multinivel SQL Query
Is there any way we can connect remotely and nave a look
Peter
Peter
Mike
ETL Architect
Please Log in or Create an account to join the conversation.