php - sql query not returning correct results -
ive got table containing results sport competition 2009 - present. table contains numerous columns such hometeam, awayteam, homescore, awayscore etc. can see image below:
if want display results team (in example team sharks) for both home , away matches so:
select * `results` `hometeam` = 'sharks' || `awayteam` = 'sharks'
the above code working fine , correct results can see image:
the problem
the problem im having when want display both home , away match results 2 specific teams, im not getting correct results. (in query below im trying display home , away results when team stormers played against team sharks) query table follows:
select * `results` `hometeam` = 'stormers' || `awayteam` = 'stormers' && `hometeam` = 'sharks' || `awayteam` = 'sharks'
you can see image below above query returning wrong results. query returning results both team stormers , team sharks home , away matches against opponents
the question
im looking way query only return results specific teams when played against each other home , away. example: query wanted display results team stormers against team sharks, ignoring other opponents.
if can kind point me in right direction appreciated. thank in advance.
i looks have wrong logic. try this:
select * `results` (`hometeam` = 'stormers' , `awayteam` = 'sharks') or (`hometeam` = 'sharks' , `awayteam` = 'stormers')
Comments
Post a Comment