Re: Static Select statements

From: Ubiquitous <weberm_at_polaris.net>
Date: Mon, 31 Mar 2008 05:03:21 -0400
Message-ID: <ANqdnZpr5d1Li2_anZ2dnUVZ_hjinZ2d@giganews.com>


bigbuck714_at_aol.com wrote:
>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

Thank you! That's exactly what I was seeking! The 'TABLE' literal should be enclosed with double quoyes ("), however. Received on Mon Mar 31 2008 - 04:03:21 CDT

Original text of this message