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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Query with aggregate functions

Author  Topic 

blackX
Posting Yak Master

102 Posts

Posted - 2009-10-02 : 15:49:31
I do not know if this is possible but I have the following query


select salesrep, prestndate, count(member_id) from member where prestndate between '9/15/2009' and '9/21/2009' and
contactstatus='Showed' group by salesrep, prestndate


This 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 results

to 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
Go to Top of Page
   

- Advertisement -