permaculture playing cards*
The moose likes JDBC and the fly likes SQL Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Query" Watch "SQL Query" New topic
Author

SQL Query

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
just want an SQL query for the below mentioned condition.

There are several department having some number of employees.
Want the department id and respective salary for the department having maximum of average salary group by department.

Thanks in advance
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38007
    
  22
Don't know myself. And I shan't know. We don't simply give out answers to that sort of question. Read this. Please post what you think and I am sure somebody will help.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

If you are stuck, try starting with a smaller query. Can you figure out how to write a query to get the highest salary of an individual employee? How about the average salary for a single department? All the departments? etc

When you get stuck, post the last query you were able to write (that solves a smaller problem) and let us know what you got stuck on. This will let people give you more concrete help and will help you learn how to write queries. Handing out an answer doesn't do that.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Query
 
Similar Threads
Query -- select maximum salary in a sum table
Display the sequence numbers on the output rows of a select in Oracle 10g
Joins in Hibernate
SubQuery in Hibernate
adding a section and subsection dynamically