title: Group By/Distinct in Access 2007
body: <p>I have a query in which I select multiple columns, but only need the results to return a distinct set of data:</p>
  
  <pre><code>Dim strSQL As String
  
  strSQL = "SELECT REQUIRED_TOOLS.REQUIRED_TOOL_NSN, REQUIRED_TOOLS.REQUIRED_TOOL_NAME, REQUIRED_TOOLS.ID, OEM_MASTER.OEM_No, REQUIRED_TOOLS.IS_TEST_EQUIP, OEM_MASTER.OEM_IN_INVENTORY, AIRCRAFT_EQUIPMENT.ID"
  
  strSQL = strSQL &amp; " FROM (OEM_MASTER INNER JOIN (REQUIRED_TOOLS INNER JOIN REL_OEM_TO_NSN ON REQUIRED_TOOLS.ID = REL_OEM_TO_NSN.NSN_REF_ID) ON OEM_MASTER.ID = REL_OEM_TO_NSN.OEM_REF_ID) INNER JOIN (AIRCRAFT_EQUIPMENT INNER JOIN REL_AC_EQUIP_TO_TOOLS ON AIRCRAFT_EQUIPMENT.ID = REL_AC_EQUIP_TO_TOOLS.AC_EQUIP_ID) ON REQUIRED_TOOLS.ID = REL_AC_EQUIP_TO_TOOLS.TOOL_ID"
  
  strSQL = strSQL &amp; " WHERE (((REQUIRED_TOOLS.IS_TEST_EQUIP)=No) AND ((OEM_MASTER.OEM_IN_INVENTORY)=Yes) AND ((AIRCRAFT_EQUIPMENT.ID)=" &amp; Me.List0.Column(2) &amp; "))"
  
  strSQL = strSQL &amp; " GROUP BY REQUIRED_TOOLS.REQUIRED_TOOL_NAME"
  
  Me.List1.RowSource = strSQ
  </code></pre>
  
  <p>When I comment out the group by clause, I get results, but multiple results of REQUIRED_TOOL_NAME (which only exist in its own table once, but can have multiple OEM_MASTER.OEM_No references in the OEM_MASTER.OEM_No table/column). I need to filter out all repeat instances in my list. </p>
  
  <p>Thanks.</p>