How can I get the sum of ‘ExpCounter’? I want to end up with Batch_Number and Sum of ExpCounter in my results.

select batch_number, sum(acount)/aSize as 'ExpCounter'
      from HMIExpCount2
      where aDate >= '03/01/2010'
      and aDate <= '03/02/2010'
      and batch_number = '118705'
      group by batch_number, asize

Thanks!

There might be a better way, but this should work:

select batch_number, sum(ExpCounter) from (
  select batch_number, sum(acount)/aSize as 'ExpCounter'
      from HMIExpCount2
      where aDate >= '03/01/2010'
      and aDate <= '03/02/2010'
      and batch_number = '118705'
      group by batch_number, asize
)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.