Re: SQLPLUS - Your Help reqrd.

From: <pberetta_at_my-deja.com>
Date: Sat, 04 Dec 1999 00:48:33 GMT
Message-ID: <829od1$101$1_at_nnrp1.deja.com>


Gokar,

   Are you trying to determine if a given value exists in all the tables? If so, assuming you know the names of all the tables you are interested in, the name of the column in each of them, and the value you wish to test to determine if it exists in all the tables, then you could:

SELECT table1.column_name
FROM table1
WHERE column_name = value
 AND 0 < (SELECT count (*)

             FROM   table2
             WHERE  table2.column_name = table1.column_name)
 AND    0 < (SELECT count (*)
             FROM   table3
             WHERE  table3.column_name = table1.column_name)

 just keep chaining these AND's till you have all your table names. If you want to find all the values in the first table that exist in all the other tables, just write it as:

SELECT table1.column_name
FROM table1
WHERE 0 < (SELECT count (*)

             FROM   table2
             WHERE  table2.column_name = table1.column_name)
 AND    0 < (SELECT count (*)
             FROM   table3
             WHERE  table3.column_name = table1.column_name)

Hope this helps.
Paul

n article <0a0133f8.6b107f08_at_usw-ex0108-061.remarq.com>,   Gokar <gokarNOgoSPAM_at_consultant.com.invalid> wrote:
> Hi All
>
> Any Body help me this it would be more appriciated.
> How can I find a field value in all my tables. Which filed
> having same value in all my table. Some table it stores same
> value in different field name.
>
> Thanks & Regards
>
> Gokar
>
> * Sent from AltaVista http://www.altavista.com Where you can also
find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sat Dec 04 1999 - 01:48:33 CET

Original text of this message