|
Posted by sqlservernewbie on 10/13/06 16:27
Hello,
I'm trying to something that just works in Oracle, but does not in Sql
Server.
How can I get the percentage of two counts to be returned on each row
of the query?
select count(sid), /* all not the not null */
count(*),
(count(sid) / count(*) ) as percent_not_null,
4 as four,
(3/4) as three_over_four
from dbo.sysusers
70 82 0 4 0
Incredibly, it changes even 3/4 into a zero!
For efficiency, I want the percentage returned in the query.
And to not use variables and coding. Efficiency,
both of the server, and of my time.
Note: I am using dbo.sysusers as an EXAMPLE only. My real
query will be on user defined application tables.
What is the solution please?
Navigation:
[Reply to this message]
|