Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I do not know if this is possible but I have the following queryselect salesrep, prestndate, count(member_id) from member where prestndate between '9/15/2009' and '9/21/2009' and contactstatus='Showed' group by salesrep, prestndateThis query will give me the counts of the leads that have viewed our product. I would like to have the count of sales in the same query. I can easily do this in a seperate query but it makes it difficult to view the resultsto calculate the sales I use count(member_id) where contactstatus='Showed' and prestnstatus='S'Is this possible?
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-10-03 : 14:39:38
seems like:-
select salesrep, prestndate, count(member_id),count(case when prestnstatus='S' then member_id else null end) as sales from member where prestndate between '9/15/2009' and '9/21/2009' and contactstatus='Showed' group by salesrep, prestndate