Skip site navigation (1) Skip section navigation (2)

Trying to avoid double results

From: Tan ga <gndtanga(at)mail(dot)pt>
To: pgsql-novice(at)postgresql(dot)org
Subject: Trying to avoid double results
Date: 2002-10-22 13:35:47
Message-ID: 20021022143254.761BA476683@postgresql.org (view raw or flat)
Thread:
Lists: 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

Next:From: Evert CartonDate: 2002-10-22 16:31:02
Subject: Calling functions indirectly using their name
Previous:From: Sergey MamvriyskyDate: 2002-10-22 13:05:00
Subject: Help with "struct Port"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group