title: Select statment from multiple tables, with variable input
body: <p>I have two tables: <code>AreaCode</code> and <code>EquipmentNumber</code>.</p>
  
  <pre><code>+------------------------------------+
  | AreaCd                             |
  |------------------------------------|
  | AreaID INT NOT NULL AUTO_INCREMENT |
  | Code INT                           |
  | Name CHAR(30)                      |
  | Comments TEXT                      |
  | PKEY (AreaID)                      |
  +------------------------------------+
  +------------------------------------+
  | EqNum                              |
  |------------------------------------|
  | EqID INT NOT NULL AUTO_INCREMENT   |
  | AreaID INT                         |
  | Number CHAR(5)                     | 
  | Type CHAR(10)                      |
  | PKEY (EqID)                        |
  | FKEY (AreaID) REF AreaCode(AreaID) |
  +------------------------------------+
  </code></pre>
  
  <p>I want to extract <code>EqNum.Number</code>, <code>Eq.Type</code> and <code>AreaCd.Code</code>. The trouble is, that the query is populated by input from a form, so the search restrictions are variable. I have created 3 seperate queries similar to these:</p>
  
  <pre><code>"SELECT Number, Type, Code FROM EqNum, AreaCd " +
  "WHERE EqNum.AreaId = AreaCd.AreaId AND Code = " + int nCode + ";";
  
  "SELECT Number, Type, Code FROM EqNum, AreaCd " +
  "WHERE EqNum.AreaId = AreaCd.AreaId AND Number = '" + string sNumber + "';";
  
  "SELECT Number, Type, Code FROM EqNum, AreaCd " +
  "WHERE EqNum.AreaId = AreaCd.AreaId AND Type = '" + string sType + "';";
  </code></pre>
  
  <p>Which all work fine on their own, provided the user is only searching for one column (<code>Code</code>, <code>Number</code>, <em>or</em> <code>Type</code>) at a time, but I need the capability to search for one, two, <em>or</em> all three columns at once. </p>
  
  <p>I have tried using <code>OR</code>, <code>LIKE</code>, multiple selection, I've even tried casting <code>int nCode</code> as a char to use the <code>%</code> wildcard, but I just can't find something that works.</p>
  
  <p><strong>QUESTION: Can someone help me join these three queries to search the tables for any combination of all three felds: <code>EqNum.Number</code>, <code>EqNum.Type</code> and <code>AreaCd.Code</code> that will refine the search result when more fields are added?</strong> (i.e. a search for <code>EqNum.Type</code> will yield more results than a search for <code>EqNum.Number</code>, <code>EqNum.Type</code> and <code>AreaCd.Code</code>)</p>