Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: tricky SQL question
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
![]() |
![]() |