BullHalseyUSN
Technical User
The following query gets bits of information regarding all personnel in the "X" department and groups that information by DEPT and then by DeptHead.
DeptHead is a score from 1-3 where a Dept. Head=1, his/her top person=2 and then rank and file=3. In practice, there is always one DH, one head honcho, then a number of rank-and-file.
There is a small problem, however, in that, within the rank and file, personnel still need to be listed according to their rank, with the higher-ranking up top.
SELECT [NAME AND ADDRESS].SALUTATION, [NAME AND ADDRESS].Comment, TblDepartmentLookup.DeptName, [NAME AND ADDRESS].Extension, [NAME AND ADDRESS].PRD
FROM TblDepartmentLookup INNER JOIN [NAME AND ADDRESS] ON TblDepartmentLookup.DeptID = [NAME AND ADDRESS].DeptID
WHERE (((TblDepartmentLookup.DeptName)="FACILITIES"
)
ORDER BY TblDepartmentLookup.DeptID, TblDepartmentLookup.DeptName, [NAME AND ADDRESS].DeptHead;
[NAME AND ADDRESS].SALUTATION is a concatention of a person's rank, his first name and last name. So we would have
MR2 M. Smith , for example.
In our world, ranks are faily easy to parse.
They are either a 3 (or, for the most senior enlisted, 4) character code. The first 2 are letters, and for the purposes of this discussion, can pretty much be ignored.
Examples of codes:
SKC
YN1
SK2
BM3
An "xxC" is a "Chief." An xx1 is a first-class and so on down.
chief
xx1
xx2
xx3
I need, nested within the foregoing query, a clause that orders the results by rank.
In plain english, the query would be something like this:
"Show me the various info about each member, order it by department, then by dept head, then, within those, show me a hierarchy according to rank where "xxC" is the highest and "xx3" is the lowest."
(i.e. I am in effect saying 'order according to the third character in [NAME AND ADDRESS].SALUTATION')
Can someone please offer guidance? Thanks!
Have a great Access day!
BH
DeptHead is a score from 1-3 where a Dept. Head=1, his/her top person=2 and then rank and file=3. In practice, there is always one DH, one head honcho, then a number of rank-and-file.
There is a small problem, however, in that, within the rank and file, personnel still need to be listed according to their rank, with the higher-ranking up top.
SELECT [NAME AND ADDRESS].SALUTATION, [NAME AND ADDRESS].Comment, TblDepartmentLookup.DeptName, [NAME AND ADDRESS].Extension, [NAME AND ADDRESS].PRD
FROM TblDepartmentLookup INNER JOIN [NAME AND ADDRESS] ON TblDepartmentLookup.DeptID = [NAME AND ADDRESS].DeptID
WHERE (((TblDepartmentLookup.DeptName)="FACILITIES"
ORDER BY TblDepartmentLookup.DeptID, TblDepartmentLookup.DeptName, [NAME AND ADDRESS].DeptHead;
[NAME AND ADDRESS].SALUTATION is a concatention of a person's rank, his first name and last name. So we would have
MR2 M. Smith , for example.
In our world, ranks are faily easy to parse.
They are either a 3 (or, for the most senior enlisted, 4) character code. The first 2 are letters, and for the purposes of this discussion, can pretty much be ignored.
Examples of codes:
SKC
YN1
SK2
BM3
An "xxC" is a "Chief." An xx1 is a first-class and so on down.
chief
xx1
xx2
xx3
I need, nested within the foregoing query, a clause that orders the results by rank.
In plain english, the query would be something like this:
"Show me the various info about each member, order it by department, then by dept head, then, within those, show me a hierarchy according to rank where "xxC" is the highest and "xx3" is the lowest."
(i.e. I am in effect saying 'order according to the third character in [NAME AND ADDRESS].SALUTATION')
Can someone please offer guidance? Thanks!
Have a great Access day!
BH