This is how my table looks like,Here is 1 is male and 2 is female
Id Gender
1 1
2 2
3 2
4 1
this is how i expected the answer
code that i tried
Select
Pt.Id,
Pt.Gender,
sum(case when Gender= 1 then 1 else 0 end) as maleCount,
sum(case when Gender= 2 then 1 else 0 end) as femalecount
from Patients Pt
WHERE Pt.Isactive = 1 and Pt.IsDeleted=0
Group by Pt.Id,Pt.Gender
I want to get the male and female percentage.How can i achieve it