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 2005 Forums
 Transact-SQL (2005)
 COUNT function

Author  Topic 

Mondeo
Constraint Violating Yak Guru

287 Posts

Posted - 2008-02-19 : 08:47:10
SELECT DISTINCT (vehicleref) FROM vwAllMatrixWithLombardAndShortModel

This returns 3711 rows which is correct

SELECT DISTINCT COUNT (vehicleref) FROM vwAllMatrixWithLombardAndShortModel

Gives me 44111

How do I get the count from the first statement?

Thanks

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2008-02-19 : 08:49:05
SELECT COUNT ( DISTINCT vehicleref) FROM vwAllMatrixWithLombardAndShortModel


"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page
   

- Advertisement -