Please check below table :

```
Id    Code     Name      State       District     Status   
-----------------------------------------------------------
1     10001    ABC       Gujarat     Jamnagar       1
2     10002    BCA       Gujarat     Amreli         0
3     10003    XYZ       NJ          ACX            1
4     10001    VBC       Gujarat     Jamnagar       1

```

I have query below 

```
SELECT STATE,
    District,
    SUM(CASE 
            WHEN STATUS = 0
                THEN 1
            ELSE 0
            END) Active,
    SUM(CASE 
            WHEN STATUS = 1
                THEN 1
            ELSE 0
            END) InActive
FROM TableA
GROUP BY STATE,
    District

```

Now it will return following result to me 

```
State   District  Active  InActive
------------------------------------
Gujarat  Jamnagar   0       2
Gujarat  Amreli     1       0
NJ       ACX        0       1

```

But I need to count single row whose `Code` is Same, So it will return `InActive` as 1 for 
`State` `Gujarat` and `District` `Jamnagar` not 2.

How can I achieve that?