RSA
RSA

Reputation: 1

How to find count of items in a table by 2 groups

To keep it simple, I have a table with 3 columns:

  1. Request Id (eg. REQ1, REQ2, and so on)
  2. Status (possible values - In Planning, Work in Progress, In Review, Completed)
  3. Due Type (possible values - Due Today, Due Tomorrow, This Week, Next Week, In 15 Days)

Now, all I want to find out is, how do I arrive at a result which will tell how many In Planning are Due Today, how many In Review are Due tomorrow and so on.

Tried using count with over and partition by, but it gives me the count of statuses and count of due types but not a combination of both maintaining the relation

Upvotes: 0

Views: 30

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269623

Are you just looking for aggregation?

select due_type, status, count(*)
from t
group by due_type, status;

If so, this is a basic SQL query. You should brush up on group by and other SQL fundamentals.

Upvotes: 1

Related Questions