15,561,685 members
See more:
Hello,

I wanted to know if it is possible to select 1 value from 2 diferent Columns in the same table and display them in the same column.

Heres an Example.
```Total Free Space     |     Total Space
10                            30
20                            10
40                            20```

Show something like:
```10 --First Column
30 --Second Column```

Thank You.
Best Regards.
Posted
Updated 24-May-12 11:38am
v3

## Solution 1

SQL
```SELECT F1
FROM Table1
UNION ALL
SELECT F2 AS F1
FROM Table2```

More at MSDN: UNION[^]

[EDIT]
Analogically, if data comes from the same table:
SQL
```SELECT F1
FROM Table1
UNION ALL
SELECT F2 AS F1
FROM Table1```

[/EDIT]

v2
Member 8956437 24-May-12 7:20am
What if they are in the same table?
Maciej Los 24-May-12 8:37am
In the first post, you have wrote, that columns comes from different tables. So... an answer is as is.
Analogically... See my answer after changes.
VJ Reddy 24-May-12 8:49am
Maciej Los 24-May-12 11:48am
Thank you, VJ ;)
Sandeep Mewara 25-May-12 1:54am
Good one. 5!

## Solution 2

you can use union all for this
e.g.
SQL
`select column_Name1 from tbl_1 union all select column_Name2 from tbl_2`

v2
Member 8956437 24-May-12 7:20am
What if the Values are in the same table, but in diferent Columns
ujju.1 24-May-12 8:52am
even then, it will be similar to the first one. i.e.
select column_Name1 a from tbl_1 union all select column_Name2 a from tbl_1

## Solution 3

You haven't mentioned the exact logic you're trying to use since the answer may vary depending on the needs. But if you want for example pick a value from some column in your query then you can use CASE[^]

An example
SQL
```SELECT CASE
WHEN column1 = 10 THEN column1
WHEN column2 = 30 THEN column2
ELSE column3
END AS ResultColumnName
FROM YourTable```