Results 1 to 3 of 3
  1. #1
    sgramesh75 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    2

    soccer table head-to-head query

    Hi Guys,
    I have table called Match_Details and inserting records like goal,foul,coronr,red & yellow card
    I need sum(goal) head to head query, for example if I send parameter (teamid 1 & 2) the query should return record only teamid 1 play with teamid 2

    result: teamA TeamB
    3 1

    My Table structure
    Tourid Match_Id teamid goal
    1 1 1 1
    1 1 2 1
    1 1 1 1
    1 2 1 1
    1 2 3 1


    1 3 1 1
    1 3 2 0


  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,798
    Something like
    Code:
    SELECT Tourid, Match_Id, teamid FROM Tourid WHERE Tourid=1 AND Match_Id = 1 AND teamid = 1
    UNION
    SELECT Tourid, Match_Id, teamid FROM Tourid WHERE Tourid=1 AND Match_Id = 1 AND teamid = 2
    The above assumes you care about the tour and match being the same for both teams, otherwise in subsequent years, you'll get records you don't want where the tourid is some other number but the team and match numbers are repeated. I have no idea how you want to provide those number to the query, so I just used #1 for example.

    but you have two rows of 1,1,1,1 which doesn't seem right.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    sgramesh75 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    2
    Thanks for ur reply...but i am inserting each info during soccer match (like goal,red card,offside...) and each match_id has two teams, if i send parameters team_id 1 & 2 the result sum(goal) for both team should return only team_id 1 played with team_id 2 group by match_Id


    I have another table called Match_Master and field structure
    Match_Id, TeamA-Id,TeamB-Id)......
    1 1 2
    2 1 3
    3 1 2

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 01-06-2017, 03:36 AM
  2. can't get my head around this If statement
    By sdel_nevo in forum Programming
    Replies: 2
    Last Post: 01-05-2016, 05:44 AM
  3. in Way over my head HELP
    By 91hrdbdy in forum Programming
    Replies: 8
    Last Post: 11-26-2013, 01:06 PM
  4. Head Scratcher.
    By Shido151 in forum Access
    Replies: 1
    Last Post: 04-03-2012, 01:25 PM
  5. In over my head
    By TylerB in forum Access
    Replies: 2
    Last Post: 05-04-2011, 04:07 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums