I have my table structure like below in desc order
sr group name status
4 class11 ghanshyam Joined
3 class11 ghanshyam Removed
2 class11 ghanshyam suspended
1 class11 ghanshyam joined
Now I want to fetch all record in group class11 whose status is Removed.
So my query will be
select * from table where group = 'class11' and status='Removed' group by name
but now ghanshyam has rejoined group after status removed and we are duplicating entries so it should not count in Removed, same for suspended account.
So how Can I fetch desired row from table