Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ann
Posting Yak Master
220 Posts |
Posted - 2007-02-08 : 18:19:15
|
Is there someway I can Identify which table a particular row is when I do a union? For ex., I have a simple union:SELECT CID, CDescriptionFROM CorporateunionSELECT SID, CDescriptionFROM RegionalWhen I get the result set, I need to know which tables they came from (either Corporate or Regional).Thanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-08 : 18:23:22
|
SELECT CID, CDescription, 'From Corporate' AS WhichTableFROM Corporateunion allSELECT SID, CDescription, 'From Regional' AS WhichTableFROM RegionalOr use an integer (1, 2).Tara Kizer |
 |
|
|
|
|