Calculating the percentage in SQL -


i trying percentage completed of project in app. percentage displayed plugin, plugin requires sql command run query , make calculation.

basically, project have milestones assigned user. each milestone have field mark complete.

milestones , fields related milestone (milestone id, status, due date, etc) written table: eba_proj_status_ms. status includes these values: assigned, in progress, completed.

what want plugin display is, percentage of how many milestones marked 'completed' specific project. once milestones marked completed, plugin should display 100%. because it's specific project, know clause needs incorporated. need calculating percentage based on how many "completed" entries there are.

i don't have developer background using sql platform build app. awesome, thanks!

here's 1 attempt:

select 100.0*count(case when status = 'completed' 1 end)       / count(1) pctcomplete eba_proj_status_ms      

similar @sam cd without sub-select


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -