假设我有一张桌子 - 人
id | First Name | Last Name
-----------------------------'
1 AA BB
2 EE DD
3 CC FF
在这里,我想在1列中显示名字和姓氏。
Such that output would be
----------------------
AA
BB
CC
DD
EE
FF
Can i also display it as
------------------
1 AA
1 BB
3 CC
2 DD
2 EE
3 FF
使用Mysql查询??
答案 0 :(得分:2)
您正在寻找nginx -V
:
1.8
编辑:
修改后的问题:
union all
答案 1 :(得分:0)
如果要根据ID对结果进行排序。然后,
<强>查询强>
select t.name from(
select id, firstname as name
from tblPersons
union all
select id, lastname as name
from tblPersons
)t
order by t.id, t.name;
答案 2 :(得分:0)
select * from
(
select first_name from person
union
select last_name from person
)
t
order by first_name