I've got a bit of an issue in Access whereby I need to order by one column containing time remaining (ORDER BY Round([Days].[DRem],2)
but if the number falls below 0 , I need to order by a different column containing text.
The current query is (UPDATED):
SELECT
SR.SRNum,
Round([qSLADays].[SLDaysRemaining],2) AS SLADRem,
SR.SrFreeText
FROM
(
SR
INNER JOIN
qSLAHours
ON SR.RowID = qSLAHours.RowID
)
INNER JOIN
qSLADays
ON SR.RowID = qSLADays.RowID
WHERE
(
(
(Round([qSLADays].[SLDaysRemaining],2))>=0
And (Round([qSLADays].[SLDaysRemaining],2))<=1.5
)
AND
((SR.SRStatus) In ("Open","Resolution Identified"))
AND
((SR.SRSubstatus) In ("Assigned","Technical Action","Subject Expert Action","Active Investigation"))
AND
((SR.Team)="SWx PAS Support MILL")
)
OR
(
((SR.SRSubstatus) In ("Assigned","Technical Action","Subject Expert Action","Active Investigation"))
AND ((SR.SrFreeText) Like "PRIORITY*")
)
ORDER BY Round([qSLADays].[SLDaysRemaining],2) DESC;
I need to Order by SLADRem where SLADRem >0 DESC else order by Freetext ASC but can't see any way to logically do this.
Appreciate any help
I can't add any images of sample output or sample output as I'm unable to add an image. However, anything greater than 0 invariably has no freetext so I firstly need to sort on anything greater than 0. Anything less than 0 needs to be sorted by the freetext field which contains a priority number defined as "PRIORITY0X" E.G.:
0.93
0.52
0.49
0.16
-6.66 PRIORITY07
-7.34 PRIORITY02
-7.94 PRIORITY09
-8.32 PRIORITY01
-9.15 PRIORITY05