Seems, you're using PostgreSQL...
The base idea is to get total no. of logs and count of specific errors:
Total:
SELECT COUNT(*) AS TotalCount
FROM log;
Count of specific error
SELECT COUNT(*) AS ErrCount
FROM log
WHERE status = '404 NOT FOUND';
Now, you have to "join" both results into single value:
SELECT ErrCount/Total AS Err404
FROM
(
(<here_comes_second_query>) as ErrCount,
(<here_comes_first_query>) as Total
) as partial_data;
See:
sql - How to reuse a result column in an expression for another result column[
^]
[EDIT]
SELECT COUNT(*) / COUNT(CASE WHEN status='404...' THEN 1 END) AS MyResult
FROM log;
Thanks
Kornfeld Eliyahu Peter[
^] for your valuable suggestion!