Calculating percentage over sub query SQL
Part of the secret is

SELECT  (...)/total, ...
    FROM campaigns_log
    JOIN ( SELECT SUM(...) AS total FROM ... ) x


That is, compute the total separately and make it available in the expressions.

Similarly:

SELECT @total := SUM(...) FROM ...
SELECT (...)/@total, ...