I feel a bit dumb, but getting a bit clueless

Поиск
Список
Период
Сортировка
Искать
От
Michiel Lange
Тема
I feel a bit dumb, but getting a bit clueless
Дата
Msg-id
3FAB9036.6000900@minas.demon.nl
Список
Дерево обсуждения
I feel a bit dumb, but getting a bit clueless Michiel Lange <michiel@minas.demon.nl>
Re: I feel a bit dumb, but getting a bit clueless Stephan Szabo <sszabo@megazone.bigpanda.com>
I am certainly not awake, that I have troubles with a simple thing like 
this, but there it is....

I have three tables: Names(NameID INT4 PRIM INDEX, Name VARCHAR(30)), 
Groups(GroupID INT4 PRIM INDEX, Group VARCHAR(30))
And a table Members(NameID,GroupID) PRIM INDEX ON (NameID, GroupID)

Now I put some data in all three tables, first created some Names (a 
grand total of 4) and a few groups (a grand total of 6)
And Members like this (NameID, GroupID)
1, 1
1, 2
1, 3
2, 1
2, 4
2, 5
3, 2
3, 6
4, 1

Now I want to show essentially the Members table, but the numbers should 
be replaced by the Names that go with the ID.
When I try this query:
SELECT "Name", "Group" FROM "Names", "Groups" RIGT JOIN "Members" ON 
'Names.NameID' = 'Members.NameID' AND 'Groups.GroupID' = 'Members.GroupID';

I get 24 results (6 times 4 = 24) so, it shows like all names are member 
of all groups... That's not true...
If I change from a LEFT JOIN to a RIGHT JOIN, it gets even stranger: I 
get 36 (4 * 9) results... but the name for Group is left empty.

So somewhere I make a huge thinking mistake... but getting a bit 
clueless where I am going wrong...
Can someone help me out? It gets frustrating... :(

- feeling a bit silly too, this is basics... -
Michiel



В списке pgsql-admin по дате отправления
От: Dani Oderbolz
Дата:
Сообщение: pg_atoi: zero-length string
От: Christian Brosig
Дата:
Сообщение: Out of buffer error
FAQ