on-internet
← Community

SQL query to count number of objects in each state on each day

Stack Overflow ·

Given a set of database records that record the date when an object enters a particular state, I would like to produce a query that shows how many objects are in each state on any particular date. The results will be used to produce trend reports showing how the number of objects in each state changes over time. I have a table like the following that records the date when an object enters a particular state: ObjID EntryDate State 1 2014-11-01 A 1 2014-11-04 B 1 2014-11-06 C 2 2014-11-01 A 2 2014-11-03 B 2 2014-11-10 C 3 2014-11-03 B 3 2014-11-08 C There are an arbitrary number of objects and s

Comments

Sign in or sign up to comment and upvote.

No comments yet.