mattz608 mattz608 - 3 months ago 19
SQL Question

SQL Ordering and Adding a Row

Here's my SQL code:

SELECT DISTINCT
CASE
WHEN RS != ''
THEN RS
ELSE 'Unspecified RS'
END AS 'RS Name'
FROM
OutstandingClaims


It'll return

Alexa
Bob
Cary
Dylan
...
Unspecified RS
...
etc.


I want to have the entry "All" at the top of this list. Is there a way I can do that without renaming people?

Answer
SELECT 'All' AS 'RS Name'
union all
SELECT DISTINCT CASE WHEN RS <> '' 
                     THEN RS 
                     ELSE 'Unspecified RS' 
                END 
FROM OutstandingClaims
Comments