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: | 9D8BB61A24FCD0118E83080036CE9603D2E351@ntserver01.gmsi.co.za |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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
comment?
-----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.
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.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | Giles Lean | 2001-05-28 12:33:31 | Re: Table joining problem. |
Previous Message | Johan Daine | 2001-05-27 02:41:17 | Re: LIKE upper('%$info%') -- (like google) |