A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Reterving of top 5th value from the table



 
 
Thread Tools Display Modes
  #1  
Old February 16th, 2007, 07:17 AM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 1
Default Reterving of top 5th value from the table


Table - employee_1

E_ID E_Name Salary
1 Pavan Kumar 5000
2 Ashok 2000
3 Gangadhar 4000
4 Riyaz 2000
5 Kalyan 1000
6 Param 6000
7 Ganesh 7000
8 Pavan Kumar Reddy 8000
9 Vijay 9000
10 Praveen 10000


I had written below query for retrieving the top 4 and 5th values from
a table, but i am not able to retrieve the result,

SELECT TOP 5 employee_1.salary
FROM employee_1
ORDER BY employee_1.salary DESC;

Please help me in this query


Thanks & Regards,
Damodar.M

  #2  
Old February 16th, 2007, 12:56 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Reterving of top 5th value from the table

The query looks good to return to the TOP five salaries. What do you get
returned and what do you want returned?

Do you want all the fields returned for E_ID 10, 9, 8, 7, and 6?

Do you want just 6 and 7 returned (4th and 5th highest)?

First is easy, just add in the other fields to your query.

Second is almost as easy, use the existing query as the source for another
query returning the Top 2 Ascending.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

wrote in message
ups.com...

Table - employee_1

E_ID E_Name Salary
1 Pavan Kumar 5000
2 Ashok 2000
3 Gangadhar 4000
4 Riyaz 2000
5 Kalyan 1000
6 Param 6000
7 Ganesh 7000
8 Pavan Kumar Reddy 8000
9 Vijay 9000
10 Praveen 10000


I had written below query for retrieving the top 4 and 5th values from
a table, but i am not able to retrieve the result,

SELECT TOP 5 employee_1.salary
FROM employee_1
ORDER BY employee_1.salary DESC;

Please help me in this query


Thanks & Regards,
Damodar.M



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.