How to merge two columns in sql and display it into a separate record

后端 未结 3 515
臣服心动
臣服心动 2021-01-26 08:49

I have this table

Column1|Column2
1       2
3       4

I want to merge two columns and make them appear like this

 NewColumn
 1         


        
3条回答
  •  终归单人心
    2021-01-26 09:15

    I would advice to do this using php or some script but not using mysql. Still, you can achieve this with mysql like this:

    SELECT t1.Column1 FROM table as t1
    UNION
    SELECT t2.Column2 as column1 FROM table as t2 ORDER BY Column1;
    

提交回复
热议问题