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

RE: Table joining problem.

From: Stoffel van Aswegen <Stoffelva(at)gmsi(dot)co(dot)za>
To: "'GCS'" <gcs(at)c64(dot)rulez(dot)org>
Cc: "PostgreSQL Mailing List (E-mail)" <pgsql-novice(at)postgresql(dot)org>
Subject: RE: Table joining problem.
Date: 2001-05-28 05:37:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
For MS SQL Server I would do the following:

select * from users
inner join teams on users.x = teams.x
left join challange on users.y = challange.y
where challange.z is null

I'm not sure if PostgreSQL supports the above; perhaps someone could

-----Original Message-----
From: GCS [mailto:gcs(at)c64(dot)rulez(dot)org]
Sent: 26 May 2001 10:23
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] Table joining problem.


 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.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

pgsql-novice by date

Next:From: Giles LeanDate: 2001-05-28 12:33:31
Subject: Re: Table joining problem.
Previous:From: Johan DaineDate: 2001-05-27 02:41:17
Subject: Re: LIKE upper('%$info%') -- (like google)

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