Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging two columns into one from an outer join 2

Status
Not open for further replies.

jbright00

Programmer
Jan 15, 2005
7
US
I have the following query:

SELECT Rejects.cDCN,ScanReject.ImageName FROM Rejects
FULL OUTER JOIN IDC_ScanReject ON Rejects.iid = IDC_ScanREject.iid

The data looks like this:

Rejects.cDCN
12345
67890

ScanReject.ImageName
89231
32412


I want this:

SingleColumnName
12345
67890
89231
32412

But, this is what the query gives:

Rejects.cDCN ScanReject.ImageName
12345 NULL
67890 NULL
NULL 89231
NULL 32412


Any help would be GREATLY appreciated! Thanks!
 
Code:
SELECT cdcn AS col_name FROM rejects
UNION ALL
SELECT imagename FROM scanreject
ORDER BY col_name

--James
 
WHat you want is a union query not a Full outer join.

Code:
Select col1 as 'some name' from table1
Union all
Select col2 from table2

If you don;t want repeats if both tables may containthe same value, use Union instead of Union all

Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief
 
Thanks a lot!

One more question... Is there a way I could have another column telling which of the 2 select statements the value is from?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top