开发者

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
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜