Received: from neptuno.uevora.pt (neptuno.sc.uevora.pt [193.136.216.24]) by hub.org (8.9.2/8.9.1) with ESMTP id MAA34208 for ; Wed, 3 Mar 1999 12:21:32 -0500 (EST) (envelope-from mjnf@neptuno.sc.uevora.pt) Received: from neptuno.sc.uevora.pt (really [127.0.0.1]) by neptuno.sc.uevora.pt via sendmail with esmtp id (Debian Smail3.2.0.102) for ; Wed, 3 Mar 1999 17:21:12 +0000 (WET) Sender: mjnf Message-ID: <36DD6F7F.D70E0265@neptuno.sc.uevora.pt> Date: Wed, 03 Mar 1999 17:21:03 +0000 From: Mario Jorge Nunes Filipe Reply-To: mjnf@uevora.pt Organization: Universidade de Evora X-Mailer: Mozilla 4.5 [en] (X11; U; Linux 2.2.2 i686) X-Accept-Language: pt,en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: A dillema ... Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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@uevora.pt http://neptuno.sc.uevora.pt/~mjnf