I have a table 'Details' as below
| ID | NAME | PARTS | SERVICE | LOCATION | TIME |
|----|--------|-------|---------|----------|---------------|
| 1 | John | 5 | Repair | A | 1597893635294 |
| 2 | Smith | 1 | Install | A | 1597893635294 |
| 3 | Will | 1 | Repair | B | 1597893635294 |
| 4 | Jade | 10 | Install | A | 1597893635294 |
| 5 | George | 2 | Install | B | 1597893635294 |
| 6 | Ray | 4 | Repair | A | 1597893635294 |
I need the total number of rows sorted based service and location
Select SERVICE,LOCATION,count(*) as TOTAL from Details group by SERVICE,LOCATION order by SERVICE desc;
which gives result as
| SERVICE | LOCATION | TOTAL |
|---------|----------|-------|
| Repair | A | 2 |
| Repair | B | 1 |
| Install | A | 2 |
| Install | B | 1 |
I need result as
| SERVICE | A | B | TOTAL |
|---------|---|---|-------|
| Repair | 2 | 1 | 3 |
| Install | 2 | 1 | 3 |