Putting a row with a particular value on top of a sort [message #685564] |
Wed, 09 February 2022 14:56  |
 |
orHooha
Messages: 8 Registered: April 2015
|
Junior Member |
|
|
Hi,
I'm sorted records primarily by a date field, say STATUSDATE.
A record with a STATUS of 'APPROVED' should always be the most recent record. 'STARTED' or 'ISSUED' or 'IN PROCESS' is usually a previous record.
Problem is, sometimes that's not true. Sometimes, because of processing delays, 'APPROVED' will end up as the second record, and e.g. 'IN PROCESS' will be the most recent.
How do we do a basic sort of STATUSDATE, but with the exception that 'APPROVED' will always be the top record? Even if it's not the most recent, in terms of the STATUSDATE sort?
Assume the table name is STATUSES, and some of the fields are STATUSDATE and STATUS.
Is this relatively easy, or is it a complex query?
Thanks and regards,
|
|
|
|
|
|