pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: devil live <definite_ocean@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Conditional SQL Query
Date: Thu, 11 Jan 2007 21:34:50 +0000
Message-ID: <BAY20-F159C48AE0E201B150535BFEEB10@phx.gbl> (raw)


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/




view thread (10+ messages)  latest in thread

Message-ID: <BAY20-F159C48AE0E201B150535BFEEB10@phx.gbl>
Permalink:  ../BAY20-F159C48AE0E201B150535BFEEB10@phx.gbl/
Also on:    postgresql.org/message-id/BAY20-F159C48AE0E201B150535BFEEB10@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: definite_ocean@hotmail.com
  Subject: Re: Conditional SQL Query
  In-Reply-To: <BAY20-F159C48AE0E201B150535BFEEB10@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox