Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help! 1

Status
Not open for further replies.
May 29, 2003
73
US
Hi All
I have a table/query (average of dept salary by year) with below data:

DEPT Y1 Y2 Y3 Y4 Y5
ACCT 5 6
ACCT 5 6 7 8 9
ACCT 5 6 7 8
ACCT
ACCT 5 6 7
FIN 9 8 7 6
FIN 9 8
FIN
FIN 9

I would like to get the results in which maximum of periods are filled. I would need to show below results:

DEPT Y1 Y2 Y3 Y4 Y5
ACCT 5 6 7 8 9
FIN 9 8 7 6

What is the easiest way to write a query to show maximum filled fields as mentioned above?

Thanks in Advance!
 
build the query similar to the query that creates the average but replace avg() with Max()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top