Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

 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
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
works correctly ofcourse, but I _must_ check the challange table too.

Any help is greatly appreciated,
Laszlo Boszormenyi,jr.

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group