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.
Author |
Topic |
Swati Jain
Posting Yak Master
139 Posts |
Posted - 2008-01-10 : 01:22:34
|
select top 10 Count(Distinct medid),Count(Distinct patientid), Count(Distinct medid) /Count(Distinct patientid) from medications group by bdrugidI am not getting the exact output for,Count(Distinct MedID)/Count(Distinct PatientID) as its truncating the floating valueHighest Count shoud be the first. but i am not getting as expected(Distinct medid) (Distinct PatientID) division -->Column names1 1 1-->Highest shld be first5 2 2-->truncatin 5/2=2.53 3 11 1 13 2 13 3 11 1 11 1 11 1 12 1 2 How to get the exact division with a single query without writing store proc.Thanks and Regards,Swati Jain |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-10 : 03:13:04
|
UseCount(Distinct MedID)*1.0/Count(Distinct PatientID)MadhivananFailing to plan is Planning to fail |
|
|
|
|
|