Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    8

    Unanswered: issue with a query

    I have a table which displays football results, here are the columns;

    MatchId
    HomeTeam
    AwayTeam
    HomeScore
    AwayScore

    Now I want to create a query which outputs not only the results but do the following:

    If HomeScore is GREATER than AwayScore, then HomeTeam wins. And if AwayScore is GREATER than HomeScore, then AwayTeam wins. I also want to display which team wins and loses. However, if BOTH the HomeScore and AwayScore matches (both teams have 1 goal each), then display the result as a draw for both Home and Away teams.

    Help would be much appreciated

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    Try using case statement in your select clause.

    CASE WHEN HOMESCORE > AWAYSCORE THEN .....

    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •