What am I doing wrong?
| От | John Poltorak |
|---|---|
| Тема | What am I doing wrong? |
| Дата | |
| Msg-id | 20010116121028.A85@eyup.org обсуждение исходный текст |
| Ответы |
RE: What am I doing wrong?
|
| Список | pgsql-novice |
I think I'm doing something fundamenatally wrong when attempting
to use multiple tables. Can someone point out what I'm missing
from the following snippet:-
------------------------------------------
CREATE TABLE players
(player_id INTEGER NOT NULL Primary key,
player VARCHAR,
club_id INTEGER);
CREATE TABLE clubs
( club_id INTEGER NOT NULL Primary key,
club VARCHAR ,
foreign key (club_id) references players);
insert into players values (1, 'Rivaldo');
insert into players values (2, 'Kleivert');
insert into players values (3, 'Zidane');
insert into players values (4, 'Davids');
insert into clubs values (1, 'Barca');
insert into clubs values (2, 'Juve');
select player,club from players,clubs;
------------------------------------------
This is the output I get:-
player | club
----------+-------
Rivaldo | Barca
Kleivert | Barca
Zidane | Barca
Davids | Barca
Rivaldo | Juve
Kleivert | Juve
Zidane | Juve
Davids | Juve
(8 rows)
This is the output I would like:-
player | club
----------+-------
Rivaldo | Barca
Kleivert | Barca
Zidane | Juve
Davids | Juve
(4 rows)
It's probably obvious to everyone, but I don't see what I've done
wrong. Any enlightenment would be much appreiated.
--
John
В списке pgsql-novice по дате отправления: