问题
I have a table with two columns that contain ID's. I want to query the table to show one list of each ID from the two columns.
TABLE
A | B
-----
1 | 2
2 | 3
5 | 4
6 | 2
I want the result to be:
TABLE
A
-
1
2
3
5
4
6
回答1:
Use the UNION operator
SELECT A FROM TABLE
UNION
SELECT B FROM TABLE
来源:https://stackoverflow.com/questions/22976395/mysql-get-all-unique-values-between-two-columns