Skip to content
Advertisement

How to count records from database and put them into List,each row represent by the letter?

I need to take values from a database and put them into a List<Long>. I made a native query but it doesn’t work correctly. Here’s a picture of the column on my database:

columnInDb

I need to count the same statuses (“W” and “I” represent the same status but are represented by another letter). I prepared a query as shown below:

JavaScript

But it’s not working correctly. When I run the query I get the following result:

result

But it should be {2(D),2(E),1(N),1(S),1(T),3(W and I). Do you have any idea on how to fix it?

Advertisement

Answer

This query returns what you want:

JavaScript

So maybe this is the code you require (you have very complex table names):

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement