Sample Header Ad - 728x90

Get percentage from results from two case results

-1 votes
1 answer
2039 views
How i can get percentage from two resuts from case staments? SELECT *, COUNT(CASE WHEN estado_rep >=11 and RELATION=1 THEN 1 ELSE NULL END) as pendiente, COUNT(CASE WHEN estado_rep >=11 and RELATION=2 THEN 1 ELSE NULL END) as realizada from AVERIES GROUP BY ID_AV Result query now aa bb cc pendiente realizada ----------- --------- --------- xxx xxx xxx 2 1 xxx xxx xxx 3 0 I want add a query percentage to root query. (realizada*100)/(realizada+pendiente) as Progress aa bb cc pendiente realizada progress -- -- -- --------- --------- -------- xxx xxx xxx 2 1 33% xxx xxx xxx 3 0 0% Thanks
Asked by reksoz (1 rep)
Mar 7, 2019, 09:34 PM
Last activity: May 17, 2023, 06:24 PM