Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > Re: Static Sele...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 6800 of 7199
Post > Topic >>

Re: Static Select statements

by sybrandb@[EMAIL PROTECTED] Apr 4, 2008 at 12:28 AM

On Mon, 31 Mar 2008 05:03:21 -0400, Ubiquitous <weberm@[EMAIL PROTECTED]
>
wrote:

>bigbuck714@[EMAIL PROTECTED]
 wrote:
>>On Mar 28, 3:19 pm, Ubiquitous <web...@[EMAIL PROTECTED]
> 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.

Incorrect.

Sybrand Bakker
Senior Oracle DBA
 




 5 Posts in Topic:
Static Select statements
Ubiquitous <weberm@[EM  2008-03-28 15:19:32 
Re: Static Select statements
Patrick <bigbuck714@[E  2008-03-28 12:42:46 
Re: Static Select statements
Ubiquitous <weberm@[EM  2008-03-31 05:03:21 
Re: Static Select statements
sybrandb@[EMAIL PROTECTED  2008-04-04 00:28:19 
Re: Static Select statements
"Shakespeare" &  2008-04-04 09:52:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 22:28:42 CDT 2008.