A dillema ...
От | Mario Jorge Nunes Filipe |
---|---|
Тема | A dillema ... |
Дата | |
Msg-id | 36DD6F7F.D70E0265@neptuno.sc.uevora.pt обсуждение исходный текст |
Список | 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@uevora.pt http://neptuno.sc.uevora.pt/~mjnf
В списке pgsql-sql по дате отправления: