Re: work on rows

Поиск
Список
Период
Сортировка
От dev@archonet.com
Тема Re: work on rows
Дата
Msg-id 20010307.21491400@client.archonet.com
обсуждение исходный текст
Ответ на work on rows  ("Rachel Coin" <rachel@derniere-minute.org>)
Список pgsql-sql
Author: Rachel Coin <rachel@derniere-minute.org>
I have a problem with a sql query.I have two tables : the first contains 
categories and the second subcategories.
What kind of select may I use to get something like Yahoo! categories ( 
each "main" category gets *at most* three sub-categories..
Do you mean something like the following? (PS - please don't post HTML to 
mailing lists)

richardh=> select * from cats;c
---AB
(2 rows)

richardh=> select * from subcats;c | s
---+----A | a1A | a2A | a3A | a4
(4 rows)

richardh=> select cats.c,subcats.s from cats,subcats where 
cats.c=subcats.c;c | s
---+----A | a1A | a2A | a3A | a4
(4 rows)

richardh=> select cats.c,subcats.s from cats,subcats where cats.c=subcats.c 
and subcats.s
in (select s from subcats where subcats.c=cats.c limit 2);c | s
---+----A | a1A | a2
(2rows)

- Richard Huxton


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

Предыдущее
От: Roland Roberts
Дата:
Сообщение: Re: Permissons on database
Следующее
От: dev@archonet.com
Дата:
Сообщение: Re: Newbie: execute function error!