| a1 | a2 | a3 |
| 11 | null | null |
| null | 12 | null |
| null | null | 13 |
in this table i want output as follows
| D1 |
| 11 |
| 12 |
| 13 |
Give This Output
| a1 | a2 | a3 |
| 11 | null | null |
| null | 12 | null |
| null | null | 13 |
| D1 |
| 11 |
| 12 |
| 13 |
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Upendra Pratap ShahiPosted Jun 17, 2015, 5:32 AM
Upendra Pratap ShahiPosted Jun 22, 2015, 8:33 AM
Sabyasachi MishraPosted Jun 17, 2015, 5:04 AM
(
SELECT a1 as D1 FROM dbo.yourtable where a1 IS NOT NULL
UNION ALL
SELECT a2 as D1 FROM dbo.yourtable where a2 IS NOT NULL
UNION ALL
SELECT a3 as D1 FROM dbo.yourtable where a3 IS NOT NULL
) A Where D1 IS NOT NULL
Group by D1
Sabyasachi MishraPosted Jun 17, 2015, 5:01 AM
Avinash VajpayeePosted Jun 17, 2015, 1:39 AM
Avinash VajpayeePosted Jun 17, 2015, 1:29 AM
Sabyasachi MishraPosted Jun 16, 2015, 4:24 AM
Khan Abrar AhmedPosted Jun 16, 2015, 3:49 AM