title: Mysql Query Confusion
body: <p>I have these tables:</p>
  
  <ul>
  <li>domain</li>
  <li>domain_module</li>
  <li>domain_module_feature</li>
  <li>domain_module_feature_to_domain</li>
  </ul>
  
  <p>A domain can have many domain_module_feature(s), the domain_module_feature_to_domain table contains 3 columns - dmf_id, dmf_domain_id and dmf_feature_id. For ease of this example lets assume domain has just 2 columns - dm_id and dm_name.</p>
  
  <p>I want to allow an "advanced" search where i can see which domains make use of which features, for example has feature 1 and 2 but not feature 3. For some reason i cannot get my head around this at all.</p>
  
  <p>i guess the pseudo-sql would be somethink like:</p>
  
  <pre><code>SELECT * FROM `domain` 
  LEFT JOIN domain_module_feature_to_domain ON (`dm_id` = `dmf_domain_id`)
  WHERE `dmf_feature_id` = '1' AND `dmf_feature_id` = '2' AND `dmf_feature_id` != '3'
  </code></pre>
  
  <p>Can you help?</p>
  
  <p>Thanks.</p>