Reputation: 41
+-----+---------------+---------------+
| id | team_A | team_B |
+-----+---------------+---------------+
| 1 | Barcelona | Real Madrid |
+-----+---------------+---------------+
| 2 | Milan | Inter |
+-----+---------------+---------------+
select * from table and combine as team_c
and result should be like one column..
team_c as
barcelona
milam
real
inter
all rows should in team_c should be different.. because i need two show in an autocomplete dropdown?
Upvotes: 2
Views: 3644
Reputation: 1
I think this should solve your question:
SELECT team_A AS team_C FROM table UNION SELECT team_B FROM table
Upvotes: -1
Reputation: 3658
Why are you store that data into extra table. You can do using select query like
select team_a as team_c from table Union select team_b from table
Upvotes: 0
Reputation: 2296
SELECT CONCAT( team_A," ",team_B) AS team_c FROM table;
You can try this output will like
Upvotes: -1
Reputation: 2713
Try this query :
select a.team_a as team_c from table a Union select b.team_b from table b
Upvotes: 4
Reputation: 777
SELECT team_A, team_B , CONCAT_WS('', team_A, team_B) AS team_C, from table;
You can combine them using CONCAT_WS
.
Hope it will usefull!
Upvotes: -1