![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) 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 |
#7
| |||
| |||
|
|
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) 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 |
#8
| |||
| |||
|
|
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) 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 |
#9
| |||
| |||
|
|
On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) 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 |
#10
| |||
| |||
|
|
bigbuck714 (AT) aol (DOT) com wrote: On Mar 28, 3:19*pm, Ubiquitous <web... (AT) polaris (DOT) 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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |