title: SQL Count multiple Columns Having Clause
body: <p>I am trying to find duplicate records in columns <code>[MFG #]</code>, <code>[CM HT]</code>, <code>[CM WT]</code>, and <code>CBM</code>, while still seeing a few other columns named <code>ProdKeywords</code>(not in this SQL statement), and <code>DateCode</code>. However I am stuck with the <code>GROUP BY</code> clause. MS Access requires me to put in all the columns that I put in the <code>SELECT</code> statement. I have also tried putting in each column in the <code>HAVING</code> statement.</p>
  
  <pre><code> SELECT First(tblDat01Prod.[DATE CODE]) AS FirstOfDateCode, tblDat01Prod.[MFG #], tblDat01Prod.[CM HT], tblDat01Prod.[CM WDT], tblDat01Prod.[CM DPT], tblDat01Prod.CBM INTO temp_Delete
   FROM tblDat01Prod
   GROUP BY tblDat01Prod.[MFG #], tblDat01Prod.[CM HT], tblDat01Prod.[CM WDT], tblDat01Prod.[CM DPT], tblDat01Prod.CBM
   HAVING (((Count(*))&gt;1));
  </code></pre>
  
  <p>Duplicate records are in '[MFG #]' '[CM HT]' '[CM WDT]' &amp; '[CM DPT]' and I would also like to have it return each record that is a duplicate along with <code>ProdKeywords</code> and <code>DATE CODE</code></p>
  
  <p>I'd imagine the query would look something like this</p>
  
  <pre><code> SELECT tblDat01Prod.[DATE CODE], tblDat01Prod.[MFG #], tblDat01Prod.[CM HT], tblDat01Prod.[CM WDT], tblDat01Prod.[CM DPT], tblDat01Prod.CBM, tblDat01Prod.[ProdKeywords]
   FROM tblDat01Prod
   GROUP BY tblDat01Prod.[MFG #], tblDat01Prod.[CM HT], tblDat01Prod.[CM WDT], tblDat01Prod.[CM DPT], tblDat01Prod.CBM
   HAVING (((Count(*))&gt;1)) -----Except for prodkeywords and DATE CODE;
  </code></pre>