Re: Select one field/value from two different tables

From: JBond007 <nafis121_at_yahoo.com>
Date: Tue, 5 Aug 2008 07:14:12 -0700 (PDT)
Message-ID: <19303557-5944-4097-8302-7705e0aebc8b@y21g2000hsf.googlegroups.com>


On Aug 4, 7:12�pm, t..._at_panix.com (Dan Blum) wrote:
>
> I'm amazed that that actually parses.

.....I got the same response from some other programmers in my company,
.....including a DBA who, unfortunately, doesn't know code. .....Unfortunately, what worked in SQLPlus, from my original msg, doesn't work in Pro*C,
.....which complains about the word "oldschool" in the larger query's concatentation.
.....Neither SQLPlus nor Pro*C liked the union in the sub-select or the word "coalesce",
.....in someone else's response.
.....I also tried if, case, and decode, to no avail (they worked, but didn't give me what I wanted.
.....I can't believe this is as complicated as it seems!

> In any case, what you want to do is replace the concatentation operator
> with UNION - or, if the tables are really mutually exclusive, UNION ALL
> (UNION removes duplicates, which if you don't have any duplicates
> just wastes time). E.g.,
>
> (select oldschool from old where pkey = 12345
> �union
> �select newschool from new where pkey = 12345)
>
Received on Tue Aug 05 2008 - 09:14:12 CDT

Original text of this message