Sql

SantoR

Registered User.
Local time
Tomorrow, 03:53
Joined
Apr 20, 2015
Messages
38
i have a table where i am maintaining the status of the record as completed or not using Yes/No.
now to generate the report i need to show (#record completed)/(#record), and there are some where clause also.

can i write like

SELECT [(Count(tbl_status = -1)/Count(tbl_status))*100] AS [Rate]" from tbl where.... group by....
 
SELECT [(Count(tbl_status = -1)/Count(tbl_status))*100] AS [Rate]" from tbl where.... group by....

(tbl_status = -1) is an expression, the query would count these expessions, 1 per record...

try this:
SELECT [(SUM(iif(tbl_status = -1,1,0))/Count(tbl_status))*100] AS [Rate]" from tbl

ATB!
 
thanks ...it's a great trick..
 

Users who are viewing this thread

Back
Top Bottom