Welcome to Questionaries, where you can ask questions and receive answers from other members of the community.

Let us know at info@questionaries.org

how to have condition in a nested SQL query?

8 like 0 dislike
here is my SQL statement , i would like to find all the games that have the status 0 and names of teams that are like key_word or the sport's name that are like the key word. The problem is that all the games that are displayed don't have status 0 . What am i doing wrong?
-----------------------------------------------------------------------
sql="select * from games where games.status=0 and games.team_2_id
     IN (select id from teams where name like '"+key_word+"')
      or games.team_1_id
        IN (select id from teams where name like '"+key_word+"')
          or games.sport like '"+key_word+"'
--------------------------------------------------------------------------
asked 1 year ago by eagle09 (95,490 points)

1 Answer

Related questions

8 like 0 dislike
1 answer
asked 1 year ago by eagle09 (95,490 points)
8 like 0 dislike
1 answer
8 like 0 dislike
0 answers
asked 1 year ago by eagle09 (95,490 points)
7 like 0 dislike
1 answer
13 like 1 dislike
1 answer
asked 1 year ago by SeO (39,810 points)