title: you tried to execute a query that does not include the specified expression 'out_time' as an aggregate function in ms access
body: <p>Im using Ms access as my database and I'm using following query for getting the time worked:</p>
  
  <pre><code>select 
          in_time,
          out_time,
          datediff("n",b.in_time,c.out_time) as work_time,
          log_date,
          emp_id 
  from 
      (select 
          LogTime as in_time,
          SrNo,
          LogID as emp_id,
          LogDate as log_date 
      from LogTemp 
      where Type='IN' ) as b
  left join
      (select 
          SrNo as out_id, 
          LogTime as out_time,
          LogID as out_emp_id,
          LogDate as out_log_date 
        from LogTemp 
       where Type = 'OUT'
       group by SrNo) as c
  on (b.SrNo &lt;&gt; c.out_id
      and b.emp_id = c.out_emp_id
      and b.log_date = out_log_date ) 
  where  
      c.out_id &gt; b.SrNo and 
      [log_date] &gt;= #8/20/2012# and 
      [log_date] &lt;= #8/20/2012# and 
      emp_id = "8" 
  group by b.SrNo; 
  </code></pre>
  
  <p>But when I execute the query Im getting the following error:</p>
  
  <pre><code>"you tried to execute a query that does not include the specified expression 'out_time'
   as an aggregate function in ms access" error.
  </code></pre>
  
  <p>Any suggestion where I'm making the mistake.</p>