Conditional SQL Query

From: "devil live" <definite_ocean(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Conditional SQL Query
Date: 2007-01-11 21:34:50
Message-ID: BAY20-F159C48AE0E201B150535BFEEB10@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I want to write sql statement about product, product_tree_special,
product_tree_template

product has
product_code varchar(20) PRIMARY KEY,
product_name varchar(20)

product_tree_template has
product_code varchar(20) PK,
stock_code_to_make_product(20) PK,
amout float4

product_tree_spcial has
production_no serial,
product_code varchar(20) PK,
stock_code_to_make_product(20) PK,
amout float4

NOW : product_tree_template table is the default table for production
ingredients of the PRODUCT

but sometimes my customer using special product_tree table for some
production_no

how can I write a query to get right ingredients of a product basis on
production_no field

such as;

first check production_no if product_tree_special table if not found then
look at template table...

What are your suggestions?

PS: I do not wanna write PL functions for this...

Thanks

_________________________________________________________________
Hava durumunu bizden grenin ve evden yle ikin!
http://www.msn.com.tr/havadurumu/

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message M.P.Dankoor 2007-01-11 22:01:42 Re: Conditional SQL Query
Previous Message Aaron Bono 2007-01-11 19:55:40 Re: Aggregating both tables in a join?