A dillema ...

From: Mario Jorge Nunes Filipe <mjnf(at)neptuno(dot)sc(dot)uevora(dot)pt>
To: pgsql-sql(at)postgresql(dot)org
Subject: A dillema ...
Date: 1999-03-03 17:21:03
Message-ID: 36DD6F7F.D70E0265@neptuno.sc.uevora.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi

i have a table with the following schema :

Table = epoca
+---------------------------+----------------------------------+-------+
| Field | Type | Length|
+---------------------------+----------------------------------+-------+
| codigo | int4 | 4 |
| descricao | varchar() | 20 |
+---------------------------+----------------------------------+-------+

and another with

Table = aluno_inscricao
+---------------------------+----------------------------------+-------+
| Field | Type | Length|
+---------------------------+----------------------------------+-------+
| numero_aluno | int4 | 4 |
| codigo_disciplina | int4 | 4 |
| ano_lectivo | char() | 10 |
| epoca | int4 | 4 |
| semestre | bool | 1 |
+---------------------------+----------------------------------+-------+

The field epoca is an "index" to the table epoca.

The table epoca has :

sac=> select * from epoca;
codigo|descricao
------+-------------------
1|Normal
2|Especial
3|Recurso
6|Recurso Antecipado
4|Melhoria E. Normal
5|Melhoria E. Recurso

when selecting from instancia_disciplina for a particular
codigo_disciplina i get :

sac=> select distinct epoca from aluno_inscricao where
codigo_disciplina=671;
epoca
-----
1
3
4
5
6

Now if i want to get codigo and descricao from epoca according to the
results above i would do:

sac=> select distinct e.codigo, e.descricao from epoca e,
instancia_disciplina i where i.epoca=e.codigo and
i.codigo_disciplina=671;
codigo|descricao
------+-------------------
1|Normal
3|Recurso
5|Melhoria E. Recurso
6|Recurso Antecipado

Why doesn't codigo=4 show up, since before the join it did.

I tryed this both on 6.4 and 6.3.2 same results

THanks
--
Mario Filipe
mjnf(at)uevora(dot)pt
http://neptuno.sc.uevora.pt/~mjnf

Browse pgsql-sql by date

  From Date Subject
Next Message Brett W. McCoy 1999-03-03 20:02:50 return types in functions
Previous Message Tom Lane 1999-03-03 15:25:31 Re: question about pg_dump