Retrieving count of Y and count of N from a single column in a table
posted 6 years ago
I have an issue I represent a column with String of length 1 in my db for maintaining a status Y or N . This column will never allow null.
Now I need to write a hibernate query to get count of Y and count of N from that table.
Say there are x number of records for a student and this column represents pass or fail for a particular subject.
So I need to get a student by id and how many subjects he as passed and in how many he had failed in one go using hibernate.
Need samples for this. I dont know if I have to use group by or union or whatever. Please help as soon as possible.