Jump to content

Getting percentage of calculated fields


gmc1103

Recommended Posts

Hello

In my query i  have x activities, then i have the count of how many still to be executed, i need to get the percentage of the total executed

I mean i have 200 activities, 20 have been executed, so i want to have 10% done

My query is this one but missing the percentage field

SELECT COUNT(*) AS total,
                                        IFNULL(SUM(CASE WHEN (t1.dataPrevista >= CURDATE() OR ae.Fim <= CURDATE()) THEN 1 ELSE 0 END),0) AS exec
                                        FROM atividades AS t1
                                        INNER JOIN anosescolares AS ae ON (t1.`idAnoEscolar` = ae.idAnoEscolar)
                                        WHERE ae.Estado = 1;

  any help?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.