This is my query folks
Select 'A' as Region, To_CHAR(TRUNC(max(Date)),'YYYY-MM-DD') As "Incident Date" from DOT.IA_LOG
Union All
Select 'B', To_CHAR(TRUNC(max(Date)),'YYYY-MM-DD') As "Incident Date" from DOT.IA_LOG where XX IN ('S','T','F')
Union All
Select 'C', To_CHAR(TRUNC(max(Date)),'YYYY-MM-DD') As "Incident Date" from DOT.IA_LOG where XX IN ('E','W','Q')
Union All
Select 'D', To_CHAR(TRUNC(max(Date)),'YYYY-MM-DD') As "Incident Date" from DOT.IA_LOG where XX IN ('R','M','G')
I had to create the colomn Region and hard code the values to specify special names for each row and here is the result for this query
The regions here are the A,B,C and D in the code, What I want is to sort them in a special order but having one of the result to be always on the Top, so I tried to add this order by clause
ORDER BY
CASE
WHEN REGION = 'C' THEN 1
ELSE 2
END
Here's the error I got
For some reason it's not recognizing the values in Region because I'm hard coding the values in this column, Do you guys know a way where I can order by having one result to always show on top using the hard coded value I give to the column? Your help is much appreciated. Thank you