Trying to avoid double results - Mailing list pgsql-novice

From Tan ga
Subject Trying to avoid double results
Date
Msg-id 20021022143254.761BA476683@postgresql.org
Whole thread Raw
List pgsql-novice
Hi
I'm trying to select the occurrence with the higher indice(it's a field) value
and i don't want to show double occurrences like:

ALGA TP 1 0(indice) 14:00
ALGA TP 1 1(indice) 15:00 <-- i just want to show this one because this line
substitutes the previous one

The problem is that when i add the field inicio, that says when a determined
class starts, i have this double results because it starts at a different hour.


Here's my select (i don't know if it's going to help or just make it
complicated :) )

select
"salaEvento".edificio,"salaEvento".sala,evento."idPeriodo",evento.var,evento.di
sciplina,evento.turno,
evento.parte,max(evento.indice),evento.tipo,
evento.duracao from evento LEFT JOIN "salaEvento" ON
(evento.disciplina="salaEvento".disciplina AND evento.tipo="salaEvento".tipo
AND evento.parte="salaEvento".parte AND
evento."idPeriodo"="salaEvento"."idPeriodo")
where evento.disciplina='ALGA' AND (evento.tipo='T' OR evento.tipo='P' or
evento.tipo='TP')
group by evento.disciplina,evento.parte,
evento.turno,evento.var,evento.tipo,evento.duracao,"salaEvento".edificio,"salaE
vento".sala,       evento."idPeriodo" order by evento.turno,evento.tipo;
--
Crie o seu email gratuito no mail.pt
http://www.mail.pt


pgsql-novice by date:

Previous
From: Andrew McMillan
Date:
Subject: Re: arc relationship [was: db design question]
Next
From: "Josh Berkus"
Date:
Subject: Re: arc relationship [was: db design question]