Re: Table joining problem.

From: Giles Lean <giles(at)nemeton(dot)com(dot)au>
To: GCS <gcs(at)c64(dot)rulez(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Table joining problem.
Date: 2001-05-28 12:33:31
Message-ID: 20010528123331.22067.qmail@nemeton.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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
> table:

Perhaps:

select user.nick, users.number from users, teams
where users.number = teams.owner and
not exists (select * from challenge where challenge.who = users.number);

Regards,

Giles

Browse pgsql-novice by date

  From Date Subject
Next Message harrold 2001-05-28 14:06:20 Re: batch file
Previous Message Stoffel van Aswegen 2001-05-28 05:37:53 RE: Table joining problem.