Re: Static Select statements

From: Patrick <bigbuck714_at_aol.com>
Date: Fri, 28 Mar 2008 12:42:46 -0700 (PDT)
Message-ID: <742e3b07-4192-443c-bf77-0d5e7e6d1099@a23g2000hsc.googlegroups.com>


On Mar 28, 3:19 pm, Ubiquitous <web..._at_polaris.net> wrote:
> Is there a way to force a static row in a SELECT statement?
>
> For example, I have a SELECT statement which is a UNION of two identical
> tables, "A" and "B". How would one create a column which identifies the source
> table?
>
> TABLE NAME REC#
> ----- ---- ----
> A     Bob  001
> A     Tim  002
> B     Joe  001
> A     Sue  003

This should work:

Select 'A' as 'TABLE', name, recno
from a
UNION
select 'B' as 'TABLE', name, recno
from b Received on Fri Mar 28 2008 - 14:42:46 CDT

Original text of this message