aspose file tools*
The moose likes Oracle/OAS and the fly likes Group function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Group function" Watch "Group function" New topic
Author

Group function

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 618
I have a table named tuitionpayment with columns named enrollmentno,fullname, payment,due,discount (no primary key). I need to get max(due),sum(payment), and sum (discount) for every enrollment no.

This gets me the details of a particular enrollment no :



The above query gets me the detail of enrollmentno 1004, but, its gets me 3 rows with same date.
I need to get max(due),sum(payment), and sum (discount) for every enrollment no.something like this :


kunal
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18152
    
    8

Well, that seems like kind of an awkward way to do it, for a start, even if it worked. Wouldn't it be easier to just do a single Group-By query?

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 618
Thanks Paul Clapham for your reply.

You are right. My way was very awkward. I didn't thought of group by. Thanks once again Paul

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Group function
 
Similar Threads
How to get List elements
sql problem - sum is Incorrect
display reports in jsp
How to get multiple rows based on a single column value?
getting data from list returned through Hibernate