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: tricky SQL question

Re: tricky SQL question

From: Patrick Joyal <please.reply_at_to.the.newsgroup>
Date: 2000/05/04
Message-ID: <39119f96@news>#1/1

No, that would result in a table with all columns duplicated.

you should try :

select * from a where ID = 5
union
(Select * from b where Id = 5)

Job wrote in message <39119657.3C207EDC_at_pestilence.net>...
>kal121_at_my-deja.com wrote:
>
>> Hello,
>>
>> Here's the problem:
>>
>> I've split a table horizontally - now I have two tables with different
>> names, but the exact same definition. Why do this? Because the data
>> distribution is different between the two tables, even though
>> they "look" the same.
>>
>> Problem is, where I used to be able to search the primary key of a
>> single table, I now have to search against both tables. For example, ID
>> is the primary key. Table1 has id's 1,2,3 and table2 has id's 3,4,5.
>>
>> If I need to SELECT * FROM "?" WHERE id = 5, I don't have any way of
>> knowing beforehand if the data I need is in table 1 or 2.
>>
>> Is there a quick and dirty query that can tell me this?
>>
>> Right now I'm having to query against both tables in turn - if table 1
>> doesn't have it, then check table 2... and it's kinda ugly.
>>
>> I'm looking for the "secret" query that can do this, if it exists.
>>
>
>can't you do
>
>select * from a,b where id = 'x'; ?
>
>
Received on Thu May 04 2000 - 00:00:00 CDT

Original text of this message

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