select
...
count(table.id1) as count_id1,
count(table.id2) as count_id2,
round(sum(count_id1) / sum(count_id2) * 100, 1) as percent
from table
...
select round(sum(count_id1) / sum(count_id2) * 100, 1) as percent
from (
select
...
count(table.id1) as count_id1,
count(table.id2) as count_id2,
from table
...
)
...
count(table.id1) as count_id1,
count(table.id2) as count_id2,
...
SELECT round((SELECT COUNT(table.id1) FROM table) / (SELECT COUNT(table.id2) FROM table) * 100, 1) as percent