Recursive query for Product Tree

From: "devil live" <definite_ocean(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Recursive query for Product Tree
Date: 2007-04-30 14:06:33
Message-ID: BAY20-F2287862C790067221BA8B0EE4C0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have product tree for a product

product_tree table :
product_code, stock_code, amount_ratio
152.001.001, 151.001.001, 1
152.001.001, 150.001.001, 2
151.001.001 150.003.003, 3
151.001.001 150.009.001, 1

I need to write a query with result:

152.001.001, 150.003.003, 1
152.001.001, 150.009.001, 1
152.001.001, 150.001.001, 2

i.e. for 151 we have another node and i do not wanna see 151 here...but its
ingredients..

it is kind of recursive query how can i write it ? any help?

Thx in advance

_________________________________________________________________
Spam filtresi ile virslere karsi en gvenilir koruma, MSN PC Koruma'dan
geer. http://www.msn.com.tr/security/

Browse pgsql-sql by date

  From Date Subject
Next Message David Flegl 2007-04-30 14:56:46 NEW to plpythonu function?
Previous Message Kevin Hunter 2007-04-27 14:11:56 Re: Selecting rows with "static" ordering