开发者

MySQL SELECT Statment to return 2 columns into 1

开发者 https://www.devze.com 2022-12-28 22:44 出处:网络
I have a table with the following columns id, teamA_id, teamB_id Will it be possible to do a MYSQL SELECT statement that gives both teamA_id and teamB_id in the same column?

I have a table with the following columns

 id, teamA_id, teamB_id

Will it be possible to do a MYSQL SELECT statement that gives both teamA_id and teamB_id in the same column?

EDIT

Consider th开发者_运维技巧is example

From

 id, teamA_id, teamB_id
 1, 21, 45
 2, 34, 67

I need

Teams
21
45
34
67


SELECT teamA_id as 'Teams'
FROM Teams

UNION

SELECT teamB_id as 'Teams'
FROM Teams
0

精彩评论

暂无评论...
验证码 换一张
取 消