Table joining problem.

From: GCS <gcs(at)c64(dot)rulez(dot)org>
To: pgsql-novice(at)postgresql(dot)org
Subject: Table joining problem.
Date: 2001-05-26 20:22:34
Message-ID: Pine.LNX.3.96.1010526221516.26851C-100000@c64.rulez.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I am not really novice, but not good either. I have a problem if the
table is empty, my select does not return anything then.
I have three tables,
1. users(nick varchar(),number int serial)
2. teams(owner references users)
3. challange(who references users)
I want to get all the users, who has a team, but not yet in the challange
table:
select users.nick, users.number from users, teams, challange where
teams.owner=users.number and challange.who!=users.number;
It does not return anything if the challange table is empty. If I insert a
line into it, it is ok. Can anyone help me out?

select users.nick, users.number from users, teams where
teams.owner=users.number;
works correctly ofcourse, but I _must_ check the challange table too.

Any help is greatly appreciated,
Laszlo Boszormenyi,jr.

Browse pgsql-novice by date

  From Date Subject
Next Message Johan Daine 2001-05-27 02:41:17 Re: LIKE upper('%$info%') -- (like google)
Previous Message Johan Daine 2001-05-26 18:43:39 Re: LIKE upper('%$info%') -- (like google)