title: How to implement a SQL Group By statement in VBA
body: <p>I'm trying to implement a SQL Group By statement in VBA. I have a simple worksheet with 4 columns (login_year, login_month, login_day, user_name) and I want to produce a count of unique users who logged in over each month.</p>
  
  <p>So the Oracle SQL would be:</p>
  
  <pre><code>SELECT 
  login_year, 
  login_month, 
  COUNT(DISTINCT user_name) 
  FROM users
  GROUP BY 
  login_year, 
  login_month;
  </code></pre>
  
  <p>How would it be best to implement this using VBA?</p>
  
  <p>Many thanks for your help.</p>