How to count rows in database with the same value and show it on Jasper Report?

Client Table                                                                           Loanaccount Table

ENCODEDKEY     LASTNAME                                         ACCOUNTHOLDERKEY     

123456                    John                                                       123456
134679                    Smith                                                     123456
246810                    McDonald                                              123456
                                                                                               134679
                                                                                               246810

 

I'm new in Jaspersoft Studio
How can I show in my report how many times an ENCODEDKEY is show in the ACCOUNTHOLDERKEY?
Thank for the help. Much appreciated 

                

dhie's picture
15
Joined: Jan 25 2018 - 12:30am
Last seen: 4 years 8 months ago

1 Answer:

Isn't this more of a query question? How about

SELECT 
   encodekey,
   lastname,
   COUNT( la.accountholderkey) AS loans
FROM client c
LEFT OUTER JOIN loanaccount la ON la.accountholderkey = c.encodedkey
GROUP BY 
   encodekey,
   lastname

 

 

AThompson_1's picture
Joined: Nov 12 2015 - 3:24pm
Last seen: 4 years 6 months ago
Feedback
randomness