Categories and subcategories : more details

From: "Rachel Coin" <rachel(at)derniere-minute(dot)org>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Categories and subcategories : more details
Date: 2001-03-20 16:53:38
Message-ID: 00c901c0b15e$5b7dff00$6101a8c0@spidinfo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

> I have two tables : the first for categories and the second for
> subcategories.I want to get a result like Yahoo! For each category ,
> the sql
> query must return maximum 3 subcategories. I can't use "limit" in a
> subquery
> because I use Postgresql 7.0.

Examples :

table CATEG :
ida categ
1 X
2 Y
3 Z

table SUBCATEG :
idb subcateg ida
1 x1 1
2 x2 1
3 x3 1
4 x4 1
5 y1 2
6 y2 2
7 z1 3

I 'd like to obtain a table with maximum 2 subcateg per categ :

table result :

categ subcateg
X x1
X x2
Y y1
Y y2
Z z1

any help?

Regards,

Rachel

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message J.H.M. Dassen Ray 2001-03-20 17:19:32 Re: PostgreSQL; Strange error
Previous Message Michael Ansley 2001-03-20 11:48:08 RE: Backing up postgresql databases

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-03-20 17:43:20 Re: Categories and subcategories : more details
Previous Message Josh Berkus 2001-03-20 15:44:23 Re: Categories and subcategories