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

Home -> Community -> Usenet -> comp.databases.theory -> SQL Query question

SQL Query question

From: Jaime J. Maiz <jmaiz_at_lucent.com>
Date: Tue, 15 May 2001 13:12:34 -0500
Message-ID: <3B017192.AC28A70F@lucent.com>

Hello,
I have a funky query that I was wondering if anyone can give me a hand with.

I have two tables, each table has a column that contains a random size number from 1 to 16 characters long. I need to build up a query that will select rows containing the shortest similar number between the 2 tables. To complicate matters worst, one of the tables stores some of its numbers prefixed by a 1, that is if the number is 658398, then this table will store it as 1658398 and the other table will store it as 658398.

Example:
Assume I have the following two tables:

Table 1				Table 2
NUM				NUM
=============			===============
198798734			6784874
8409898				840
1874287430			98798734
1637608				6376084658

The Query must return:
840
98798734
637608

Any help will be greatly appreciated,
Jaime

-- 
Jaime J. Maiz			IH 4F-310
mailto:jmaiz_at_lucent.com		(630) 979-2088
Received on Tue May 15 2001 - 13:12:34 CDT

Original text of this message

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