0

I'm having issues getting the desired results from my database. The join_service_date and dropped_service_date columns have dates. The rejects have an r in the column if it is rejected.

I want to be able to count the agents sales, rejects, dropped sales and how many of those sales have dropped our service within 0-30 days, 31-60 days or 61-90 days. I got the results I needed from doing several small queries, but I would like to learn or know how to gather the information in a just 1 or as little as possible queries.

Also how would I specify this for a specific month like march or april.

select agentid, 
       count(join_service_date), 
       count(dropped_service_date),
       count(rejects), 
       datediff(day, join_service_date, dropped_service_date)
from dbtable
group by agentid
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

0 Answers0