mysql join 2 columns to order by
Having a real struggle with something. I have a list of fixtures that have the following:
hometeam, awayteam, date, time, season, competition.
I want to be able to join/group hometeam and awayteam so I can then group my results by this. So basicall开发者_运维技巧y I would only get one fixture per team. I obviously cant do this until I have somehow joined hometeam and away team as one column.
Any ideas how I would do this?
Try using the CONCAT() function:
SELECT CONCAT(hometeam, '-', awayteam) as fixture
, date, time, season, competition
FROM teams
GROUP BY fixture
精彩评论