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
From: GCS [mailto:gcs(at)c64(dot)rulez(dot)org]
Sent: 26 May 2001 10:23
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,
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
pgsql-novice by date
|Next:||From: Giles Lean||Date: 2001-05-28 12:33:31|
|Subject: Re: Table joining problem. |
|Previous:||From: Johan Daine||Date: 2001-05-27 02:41:17|
|Subject: Re: LIKE upper('%$info%') -- (like google)|