Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Crazy Query (same query diferents results)

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-03-10 : 08:35:41
Paulo writes "i got this query

"SELECT max(idaula), IdEdicaoCadeira, IdActividadeDocente, IdActividadeDocenteTipo, ActividadeDocenteTipo FROM vCadeiraTurmaDocenteAula WHERE (IdEdicaoCadeira = 90)
group by IdActividadeDocenteTipo, ActividadeDocenteTipo , IdEdicaoCadeira, IdActividadeDocente"

the result is

NULL 90 111 1 Teórica
NULL 90 112 2 Teórica-Prática
NULL 90 113 3 Prática
NULL 90 114 7 Regência

same query without "max(idaula),"

"SELECT IdEdicaoCadeira, IdActividadeDocente, IdActividadeDocenteTipo, ActividadeDocenteTipo FROM vCadeiraTurmaDocenteAula WHERE (IdEdicaoCadeira = 90)
group by IdActividadeDocenteTipo, ActividadeDocenteTipo , IdEdicaoCadeira, IdActividadeDocente"

the result is

90 114 7 Regência

why i don't have the same 4 results?"

X002548
Not Just a Number

15586 Posts

Posted - 2004-03-10 : 11:01:54
You shouldn't...something else is going on...what does



SELECT DISTINCT
IdEdicaoCadeira
, IdActividadeDocente
, IdActividadeDocenteTipo
, ActividadeDocenteTipo
FROM vCadeiraTurmaDocenteAula
WHERE IdEdicaoCadeira = 90




give you?



Brett

8-)
Go to Top of Page
   

- Advertisement -