Query Probs??

  • Hi I am having trouble trying to figure out this sql query I need to display the opponents for a soccer team and display whether or not the team was at home or not at the moment I can display the two teams involved in the match and the stats I need but I don’t how to always get the other teams and display whether or not they were at home. This is my current query any help would be appreciated

     

     

    Select homeClub.Name + ' v ' + awayClub.Name as Match, pz.DistanceCovered From Teams t

    Join Person p on p.ID = t.PlayerID Join PZData pz on pz.TeamID = t.TeamID Join Match m on m.Id = t.MatchId

    JOIN Squad homeSquad on m.SquadA = homeSquad.[ID]

    JOIN Squad awaySquad on m.SquadB = awaySquad.[ID]

    JOIN Club homeClub on homeSquad.ClubID = homeClub.[ID]

    JOIN Club awayClub on awaySquad.ClubID = awayClub.[ID]

    where t.ClubId in (select ClubID from Squad Where ID = 5)

    and p.Id = 19

    order by m.date asc

  • I think that your table DDL and sample data would be helpful here.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply