• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A question on SQL query

 
Greenhorn
Posts: 6
Mac Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to write a query for the following?

Say I have a table "Account" as below
ACCTNO -- FUNDID -- UNITS
64746-------200----------6
64746-------200----------7
64746-------201----------4
64746-------201----------6

Now I want to select such that it returns the following rows
ACCTNO -- FUNDID -- UNITS
64746-------200----------7
64746-------201----------6
In other words the funds with maximum units.

Thanks in advance.
Sanat

 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sanat,
Yes. Take a look at the group by operator. You can use the max() function on one column if you list all the other columns in the group by clause.

Psuedocode:

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic