ORDER BY timestamp column as a string
Does any one have any tips/tricks for using an ORDER BY clause for a timestamp column that is a string?
I am developing a UNION query that combines data from a table and an audit history table to show current data plus historical data.
I had to convert the timestamp column to a string so the datatypes would match for the UNION query, but now they ORDER BY clause does not work.
For example:
SELECT
location,
'CURRENT' as VALID_DATE
FROM
person
UNION
SELECT
location,
TO_CHAR(audit_date)
FROM
person_audit
ORDER BY 2 DESC