Calculate Percentage with criteria Ignore Blank and if no value then null or Blank

  Kiến thức lập trình

I have a table with 3 coloumn, want to make percentage (‘Done’ Divide Count Coloumn Status without Blank) and if no value to divide result will become null/blank

from this table

| Group | Region | Status |
| A | 1 | |
| A | 2 | Done |
| A | 3 | Done |
| A | 1 | Done |
| A | 2 | |
| A | 3 | Cancel |
| A | 1 | Reschedule |
| B | 1 | Cancel |
| B | 1 | Reschedule |
| B | 2 | |
| B | 2 | Not Yet |
| B | 3 | Reschedule |
| C | 1 | Done |
| C | 2 | |
| C | 3 | Reschedule |
| C | 1 | |

into this table

| Group | Region | Status Done % |
| A | 1 | 100% |
| A | 2 | 100% |
| A | 3 | 50% |
| B | 1 | 0% |
| B | 2 | 0% |
| B | 3 | 0% |
| C | 1 | 100% |
| C | 2 | |
| C | 3 | 0% |

Any ideas of a SELECT SQL query that will allow me to do this?

New contributor

Aldo Putra Setia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

LEAVE A COMMENT