There is no any specific area to add this problem of mine. Thats why i add this in to windows server area.
This is a SQL problem.
I want to combine 2 columns in to one column (2 columns are in 2 tables).
There are a lot of codes in the internet. But i couldnt find a proper code what i want.

Some of code in the internet.
Eg: ([Column_1] + ' ' + [Column_2])
this join 2 colums like this.

 Column_1             Column_2
 A                       X
 B                       Y
 C                       Z

with above code it is shown the column like this

A X
B Y
C Z

But i want to get these 2 columns like this

A
B
C
X
Y
Z

PLEASE SHOW ME A DIRECTION TO DO THIS....

Recommended Answers

All 2 Replies

Hello,

Try a union statement and do two seperate queries :

Select column_1 as mycolumn from table1
union
select column_2 as mycolumn from table2

This would actually only be one query:

SELECT column_1 as myNewColumn from table1
UNION
SELECT column_2 as myNewColumn from table2

Once again, this is a SINGLE QUERY STATEMENT,highlight the whole statement and execute. Enjoy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.