I have a table (Event) that tracks events. Each event has a eventTime field. I want to get how many events occurred between time A and time B, how many events occurred between time C and time D, etc. I want each of these counts to be different (i.e. I want a distinct count for each time period). Is there a way to do this with one SQL query? Right now I’ve been doing something like:
select count(ID) from Event where eventTime >= timeA and eventTime <= timeB
and I’ve just been doing that for each period. It takes a while when I have to make five separate queries though. Thanks for the help!
1 Answer