Re: [GENERAL] Categories and Sub Categories (Nested)

2006-04-27 Thread Michael Glaesemann
On Apr 19, 2006, at 14:44 , Martin Kuria wrote: I have a postgresql database Table Categories which has the structure like this Cat_ID | Parent_ID | Name 1 | 0 | Automobiles 2 | 0 | Beauty & Health 3 | 1 | Bikes 4 | 1 | Cars 5 | 3 | Suzuki 6 | 3 | Yamaha

Re: [GENERAL] Categories and Sub Categories (Nested)

2006-04-20 Thread Alban Hertroys
Ian Harding wrote: You should look up the contrib module ltree which is made for this sort of thing. If you reinvent the wheel like this, you will be stuck with 2 levels. With ltree you can have as many as you need and add more at any time. It lets you query for ancestors and descendants of an

Re: [GENERAL] Categories and Sub Categories (Nested)

2006-04-19 Thread Ian Harding
You should look up the contrib module ltree which is made for this sort of thing. If you reinvent the wheel like this, you will be stuck with 2 levels. With ltree you can have as many as you need and add more at any time. It lets you query for ancestors and descendants of any item at any level.

Re: [GENERAL] Categories and Sub Categories (Nested)

2006-04-19 Thread Alban Hertroys
Martin Kuria wrote: Hi, I have a postgresql database Table Categories which has the structure like this Cat_ID | Parent_ID | Name 1 | 0 | Automobiles 2 | 0 | Beauty & Health 3 | 1 | Bikes 4 | 1 | Cars 5 | 3 | Suzuki 6 | 3 | Yamaha 7 | 0 | Clothes This ha