Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: JOIN !!

Re: JOIN !!

From: Erika Grondzakova <Erika.Grondzakova_at_cern.ch>
Date: Thu, 19 Aug 1999 09:18:54 +0200
Message-ID: <37BBAFDE.3A4BE33E@cern.ch>


Hi,

Maybe you can try ...

SQL> create table t1(region varchar2(10), state varchar2(10));

SQL> insert into t1 values('aaa','NY');

1 row created.

SQL> insert into t1 values('bbb','NJ');

1 row created.

SQL> create table t2(country varchar2(10));

Table created.

SQL> insert into t2 values('NY.XX');

1 row created.

SQL> insert into t2 values('NJ.YY');

1 row created.

SQL> select region, state, country from t1, t2   2 where state like substr(country,1,INSTR(country,'.')-1);

REGION STATE COUNTRY
---------- ---------- ----------

aaa        NY         NY.XX
bbb        NJ         NJ.YY

HTH Erika

Nandakumar wrote:
>
> Hi
>
> This is a question in JOINs.
>
> There are two tables, one with REGION and STATE, and another with
> COUNTY. Each county in a state will start with the name of that state,
> like NY.XX,NJ.YY etc. (!! XX and YY are name of the counties)
>
> The goal is to join these two tables to list
> REGION, STATE, and COUNTY.
>
> I tried some queries with LIKE. But no rows are selected.
> If there is a solution to this other than using CURSORs, i would be
> interested in it.
> Thanks
> -
> Nandakumar
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Thu Aug 19 1999 - 02:18:54 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US