RE: Table joining problem.

Поиск
Список
Период
Сортировка
От Stoffel van Aswegen
Тема RE: Table joining problem.
Дата
Msg-id 9D8BB61A24FCD0118E83080036CE9603D2E351@ntserver01.gmsi.co.za
обсуждение исходный текст
Ответ на Table joining problem.  (GCS <gcs@c64.rulez.org>)
Список 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@c64.rulez.org]
Sent: 26 May 2001 10:23
To: pgsql-novice@postgresql.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@postgresql.org

В списке pgsql-novice по дате отправления:

Предыдущее
От: Johan Daine
Дата:
Сообщение: Re: LIKE upper('%$info%') -- (like google)
Следующее
От: Tomasz Wegrzanowski
Дата:
Сообщение: Re: postgreSQL 7.0.3 + kdevelop 1.4.1