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:

enter image description here

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:

enter image description here

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

enter image description here

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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -