I am attempting to create an SQL statement that checks my database to see if a soccer game has already been entered into the database.
This might seem as simple as doing a Team name match with a date check, however this is not the case. Since a tournament can happen multiple games can be played on one day, therefore requiring me to check both the home team and the opposing team and the amount of goals scored for each team.
Currently I have the table in the db set up like this:
T1= home team
T2= opposing team
T1Goals = Home goals
T2Goals = opposing goals
When a coach submits scores I need the database to first sort out all games between the two teams submitted T1 and T2. From there, using those sorted I need it to see if the goals match up; T1Goals and T2Goals. If those match, then there will be no record added.
Currently this is what I have:
strSQL = "SELECT ID FROM Results WHERE T1='" & request("T1") & "' AND T2='" & request("T2") & "';" THEN
'"SELECT ID FROM Results Where T2Goals='" & request("T2Goals") & "' AND T1Goals='" & request("T1Goals") & "';"