I have table called UserProfile as mention below
I need distinct location, count for distinct location and count for status whose value is 0 at distinct location for user = user1. Status value can be between 0 t0 5(number)
so output will be
abc 3 2
abd 1 1
where abc is unique location, 3 is total count for abc in table and 2 is total count for status =0 at location abc
I Can give you some inspiration, due to I assume, that the 'status' can be only 0 or 1. If that's not true, than - I think - you have to execute two separated fetch with different predicated (one for fetch the count of location referring user1 and an other the count of status where user = user1 and status = 1).