pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mario Jorge Nunes Filipe <mjnf@neptuno.sc.uevora.pt>
To: pgsql-sql@postgreSQL.org <pgsql-sql@postgreSQL.org>
Subject: Wierd stuff
Date: Fri, 03 Dec 1999 15:24:18 +0000
Message-ID: <3847E0A2.5C8E41F9@neptuno.uevora.pt> (raw)

Hi 

I'm developing a system with a large number of tables.

One of the tables has (among others) the following fields:
Table    = aluno
+----------------------------------+---------------------------------
|              Field               |              Type                
+----------------------------------+---------------------------------
| numero_aluno                     | int4                             
| freguesia_naturalidade           | int2                             
| concelho_naturalidade            | int2                             
| nacionalidade                    | int2                             

another is like this:


-- Table    = concelho
+----------------------------------+---------------------------------
|              Field               |              Type                
+----------------------------------+---------------------------------
| codigo                           | int4                             
| nome                             | text                             

The field "concelho_naturalidade" on the first table has values taken
from the "codigo" field from the second.

Now comes the problem:

When i do :
sac=> select a.numero_aluno, a.concelho_naturalidade from aluno a where
a.numero_aluno=13792;

i get:

numero_aluno|concelho_naturalidade
------------+---------------------
       13792|                 1006
(1 row)

and whith:
sac=> select * from concelho where codigo=1006;

i get:

codigo|nome            
------+----------------
  1006|CALDAS DA RAINHA
(1 row)

but with:
sac=> select c.nome from aluno a, concelho c where
a.concelho_naturalidade=c.codigo and a.numero_aluno=13792;

i get:

nome
----
(0 rows)

If my SQL is worth anything I thought it would reply "Caldas da Rainha".
What is wrong here?

I'm using POstgresql 6.3.2 (yes i know: I should upgrade)

Thanks

--
        Mario Filipe 
        mjnf@uevora.pt
        http://neptuno.sc.uevora.pt/~mjnf



view thread (9+ messages)  latest in thread

Message-ID: <3847E0A2.5C8E41F9@neptuno.uevora.pt>
Permalink:  ../3847E0A2.5C8E41F9@neptuno.uevora.pt/
Also on:    postgresql.org/message-id/3847E0A2.5C8E41F9@neptuno.uevora.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: mjnf@neptuno.sc.uevora.pt
  Subject: Re: Wierd stuff
  In-Reply-To: <3847E0A2.5C8E41F9@neptuno.uevora.pt>
  References: <3847E0A2.5C8E41F9@neptuno.uevora.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox