title: SQL: Getting values which all other values related to each must be in another table
body: <p>I'm working in a web page with PHP and MySQL where I have this DB:</p>
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE action (
    idaction INT NOT NULL AUTO_INCREMENT,
    --Other columns
    PRIMARY KEY (`idaction`));
  
  CREATE event (
    idevent INT NOT NULL AUTO_INCREMENT,
    --Other columns
    PRIMARY KEY (`idevent`));
  
  CREATE TABLE currentGame (
    user_email VARCHAR(45) NOT NULL,
    --Other columns
    PRIMARY KEY (`user_email`));
  
  CREATE TABLE IF NOT EXISTS currentEvents (
    currentGame_user_email VARCHAR(45) NOT NULL,
    event_idevent INT NOT NULL,
    PRIMARY KEY (currentGame_user_email, event_idevent),
    FOREIGN KEY (currentGame_user_email) REFERENCES currentGame (user_email),
    FOREIGN KEY (event_idevent) REFERENCES event (idevent));
  
  CREATE TABLE IF NOT EXISTS spawnConditions (
    action_idaction INT NOT NULL,
    event_idevent INT NOT NULL,
    PRIMARY KEY (action_idaction, event_idevent),
    FOREIGN KEY (action_idaction) REFERENCES action (idaction),
    FOREIGN KEY (event_idevent) REFERENCES event (idevent));
  
  </code></pre>
  <p>So I need to do a query which has the actions which fulfill any of these conditions:</p>
  <ol>
  <li>It is not in <code>spawnConditions</code>.</li>
  <li>If it is in <code>spawnConditions</code>, all the events which it is related to in this table, must be in the subgroup of <code>currentEvent</code> with a certain known <code>user_email</code>.</li>
  </ol>
  <p>In other words, for action A1, being in <code>spawnConditions</code> with events E1 and E2, to be able to be selected from table <code>action</code>, both E1 and E2 must be in <code>currentEvents</code> with the known <code>currentGame_user_email</code>.</p>
  <p>Can it be written using only SQL or do I need to involve PHP?</p>