Re: Using conditional statements inside SQL

From: Bhooshan Prabhu <bhooshan.s.prabhu_at_orbitech.co.in>
Date: 3 Sep 2002 03:25:37 -0700
Message-ID: <16584988.0209030225.50a5a81b_at_posting.google.com>


Hello,

If you are using Oracle 8i, try and see if the following works.. select t1.whatever, CASE WHEN t1.ival = 750 THEN t2.col1 ELSE t3.col1 END from t1, t2, t3;

Also, you could use a simple UNION of columns of both Rule and Item.

regards
Bhooshan

pramod_at_rtimes.com (Pramod Ramachandran) wrote in message news:<6616e304.0209022021.500f88df_at_posting.google.com>...
> Hi all,
>
> I have a problem which is as follows :
>
> Three tables
>
> 1. TType having a field IVal which can have two groups of values 700
> and 750.
> 2. Item
> 3. Rule
>
>
> I need a query which selects a row from table Item when IVal = 700 and
> from Rule when IVal is 750.
>
> I know that this could be achieved with a procedure using an if...else
> condition, but I am curious to know if could be solved within a single
> query.
>
> TIA
>
> Pramod
Received on Tue Sep 03 2002 - 12:25:37 CEST

Original text of this message