Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT implementing_partner, number_tested, When_tested_last_HIV, age_group, total, ROUND(((number_tested/total)*100), 0) as percentage
- FROM
- ( SELECT
- (SELECT SUM(number_tested) number_tested FROM
- (SELECT count(id) AS number_tested,
- IFNULL(When_tested_last_HIV, 'Missing') AS When_tested_last_HIV, age_group, implementing_partner_id
- FROM stag_client_hiv_testing
- WHERE (
- false
- OR
- (implementing_partner = 'AFYA JIJINI' )
- )
- GROUP BY age_group, CASE WHEN false THEN NULL ELSE implementing_partner END
- ORDER BY age_group)
- A WHERE A.age_group = B.age_group AND
- (
- (
- false
- OR
- (implementing_partner = 'AFYA JIJINI' )
- )
- ))
- AS total,B.implementing_partner, B.number_tested, B.When_tested_last_HIV, B.age_group FROM
- (SELECT count(id) AS number_tested, IFNULL(When_tested_last_HIV, 'Missing') AS When_tested_last_HIV, age_group, implementing_partner
- FROM stag_client_hiv_testing
- WHERE
- (
- false
- OR
- (implementing_partner = 'AFYA JIJINI' )
- )
- GROUP BY When_tested_last_HIV, age_group, CASE WHEN false THEN NULL ELSE implementing_partner END
- ORDER BY age_group) B)
- C WHERE (
- false
- OR
- (implementing_partner = 'AFYA JIJINI' )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement