12,064,498 members (62,001 online)
Rate this:
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 24-May-12 2:08am
Edited 24-May-12 11:38am
v3

Rate this:

## Solution 1

```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:
```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?
losmac 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

losmac 24-May-12 11:48am

Thank you, VJ ;)
Sandeep Mewara 25-May-12 1:54am

Good one. 5!
losmac 25-May-12 4:07am

Thank you, Sandeep ;)
Rate this:

## Solution 2

you can use union all for this
e.g.
`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
Rate this:

## 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
```SELECT CASE
WHEN column1 = 10 THEN column1
WHEN column2 = 30 THEN column2
ELSE column3
END AS ResultColumnName
FROM YourTable```

Top Experts
Last 24hrsThis month
 d@nish 200 CPallini 175 CHill60 120 OriginalGriff 74 BillWoodruff 55
 Dave Kreskowiak 1,857 Richard MacCutchan 1,250 d@nish 980 OriginalGriff 874 CPallini 750