Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

Ranking... One More Time Please

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
QVCJDN - 31 Mar 2006 19:36 GMT
There are several posts that have discussed ranking within a query, but I'm
not too sharp at SQL and I'm having a difficult time. My query is below. I'm
trying to create a table that would show a ranking for employees by company
seniority date, without displaying the actual date.

SELECT [PeopleSoft Six-Digit].Name, [PeopleSoft Six-Digit].[6 Digit ADP],
[PeopleSoft Six-Digit].[Company Seniority Date], [PeopleSoft Six-Digit].[FLSA
Stat]
FROM [PeopleSoft Six-Digit]
WHERE ((([PeopleSoft Six-Digit].[FLSA Stat])<>"Exempt"))
ORDER BY [PeopleSoft Six-Digit].[Company Seniority Date];

Thanks for any help.
Tom Ellison - 31 Mar 2006 20:23 GMT
Dear QVC:

How about:

SELECT [Name], [6 Digit ADP], [FLSA Stat]
   (SELECT COUNT(*)
     FROM [PeopleSoft Six-Digit] T1
     WHERE T1.[FLSA Stat] <> "Exempt"
       AND T1.[Company Seniority Date] < T.[Company Seniority Date]) + 1
   AS Rank
 FROM [PeopleSoft Six-Digit] T
 WHERE [PeopleSoft Six-Digit].[FLSA Stat] <> "Exempt"
 ORDER BY [Company Seniority Date]

You can remove the + 1 for a 0 based ranking.

If two people have the same Seniority Date then they will have the same
rank, and the next ranking value will be skipped.

Tom Ellison

> There are several posts that have discussed ranking within a query, but
> I'm
[quoted text clipped - 13 lines]
>
> Thanks for any help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.