Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011

    Unanswered: Two teams from one table

    It's a very basic simple problem but it's a nuscience to explain.

    I have a table called teams. (a list of team names -team.teamname)
    I have a table called fixtures - fixtures.team1 versus fixtures.team2 (both taken from a dropdown menu of the team table.

    When MS Access creates the SQL Select, it allows for just one "teamname"

    I'm using
    <% Response.Write (rsleague("teamname"))%>
    to write it just 1 team.

    How Can I change the syntax to something like
    <% Response.Write (rsleague("fixtures.team1"))%>
    <% Response.Write (rsleague("fixtures.team2"))%>

    so I can write both teams and not their numerical identifiers?

    If this needs to be moved to either the ASP or SQL forums please do do.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    this might not have all the correct column names, but it should get you started...
    SELECT fixtures.gamedate
         , fixtures.location
         , home.teamname AS hometeam
         , away.teamname AS awayteam
      FROM fixtures
      JOIN teams AS home
        ON = fixtures.hometeam
      JOIN teams AS away
        ON = fixtures.awayteam | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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