title: Retrieving table that has a one to many relationship
body: <p>I have two tables:</p>
  
  <pre><code>Detection{
      DetectionId int
      ....
      ...
      ...
  }
  
  DetectionInfo{
      DetectionId int
      Name char
      val char
  }
  </code></pre>
  
  <p>There is a one to many relationship between these two tables.</p>
  
  <p>I want to retrieve the detections that have BOTH  val = "DOWN" and val = "Blue"</p>
  
  <p>Here is my solution:</p>
  
  <pre><code>SELECT * FROM Detection a WHERE a.DetectionId IN 
      (SELECT c.DetectionId FROM DetectionInfo c where c.val = "DOWN" and c.Detection IN
            (SELECT d.DetectionId FROM DetectionInfo d 
                WHERE d.val = "Blue"))
  </code></pre>
  
  <p>Is there a better (efficient) way to do this?</p>