George-Bowyer
Registered User.
- Local time
- Today, 05:27
- Joined
- Dec 21, 2012
- Messages
- 178
I am running on too much caffeine and too little sleep at the moment, and I can't work out whether what I am trying to do is really complicated or whether I'm just missing something really obvious...?
I have a table which tracks positions held by volunteers within various organisations. Each record holds a PeopleID from tblPeople, an OrganisationID from tblOrganisations and a PositionID from tblPositions.
Each record also has start date and retire date fields.
I want to be able to list all of the positions by current (fldRetireDate is null or in the future) first, in a certain order (fldOrder) and then the retired positions (fldRetireDate is not null and in the past) in the same order.
I do not want to sort them by fldRetireDate
Here is my current sql:
Can someone please offer some guidance?
Many thanks
George
I have a table which tracks positions held by volunteers within various organisations. Each record holds a PeopleID from tblPeople, an OrganisationID from tblOrganisations and a PositionID from tblPositions.
Each record also has start date and retire date fields.
I want to be able to list all of the positions by current (fldRetireDate is null or in the future) first, in a certain order (fldOrder) and then the retired positions (fldRetireDate is not null and in the past) in the same order.
I do not want to sort them by fldRetireDate
Here is my current sql:
Code:
SELECT tblOrganisationPositions.fldOrgPosPosition, [fldLastName] & ", " & [fldFirstName] AS fldContactName, tblPositions.fldPosition, tblOrganisationPositions.fldOrgPosOrg, tblPeople.PeopleID, tblPositions.fldOrder, & _
tblOrganisationPositions.fldOrgPosPerson, tblOrganisationPositions.fldStartDate, tblOrganisationPositions.FldRetireDate
FROM tblPositions INNER JOIN (tblPeople INNER JOIN (tblOrganisations INNER JOIN tblOrganisationPositions ON tblOrganisations.OrganisationID = tblOrganisationPositions.fldOrgPosOrg) ON tblPeople.PeopleID = tblOrganisationPositions.fldOrgPosPerson) ON tblPositions.PositionID = tblOrganisationPositions.fldOrgPosPosition
WHERE (((tblOrganisations.fldOrgType)=2))
ORDER BY tblPositions.fldOrder, tblPeople.fldLastName, tblPeople.fldInitial;
Can someone please offer some guidance?
Many thanks
George