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)
 Joins and count(distinct)

Author  Topic 

Movp69
Starting Member

10 Posts

Posted - 2009-03-19 : 12:05:41
hi,
i've got 700,000 distinct customer id's in the usage table. I want the output of this join to total this 700,000. With a left join i get 2.6m with this join i also get 2.6m. I get the feeling that the count(distinct) is not producing the result i need. any ideas?? Thanks. Mo


select a.Usage, c.packagedescription, count(distinct a.customerid)
from mvp1.dbo.Usage1 a
join suball_d b on a.customerid=b.customerid
join mvp1.dbo.subs_package_description c on b.packageid=c.packageid
join nameall d on b.nameid=d.nameid
group by a.usage, c.packagedescription
order by 1,2 asc

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-19 : 14:17:09
duplicate, please dont cross post

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=122089
Go to Top of Page
   

- Advertisement -