如何将列值设置为其他列值

时间:2016-07-08 10:38:34

标签: mysql

我的表格如下所示。

Region  Market      Cluster     Dt1-Accept  Dt2-Accept  Dt3-Accept  
South   Karnataka   Bangalore   21-06-2014  24-07-2015  25-08-2016
South   Karnataka   Belgaum     21-06-2014  24-07-2015  25-08-2016

我想用sql显示它

Region  Market      cluster     Dt1-Accept
South   Karnataka   Bangalore   21-06-2014
South   Karnataka   Belgaum     21-06-2014
South   Karnataka   Bangalore   24-07-2015
South   Karnataka   Belgaum     24-07-2015
South   Karnataka   Bangalore   25-08-2016
South   Karnataka   Belgaum     25-08-2016

请帮忙

1 个答案:

答案 0 :(得分:3)

select Region, Market, Cluster, Dt1-Accept from "table"
union all
(select Region, Market, Cluster, Dt2-Accept from "table")
union all
(select Region, Market, Cluster, Dt3-Accept from "table")