Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Group function

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic