SQL - Distinct with Case When
<p>When i use the following query it returns duplicate External IDs as it lists the different cases as different rows.</p>

<pre><code>SELECT DISTINCT

    OENT.OTHER_EXTERNAL_ID                                                                                                      AS 'Agent Master Number'       
   ,CASE WHEN SE.Organization_Name IS NULL OR RTRIM(LTRIM(SE.ORGANIZATION_NAME)) = '' THEN '' ELSE SE.ORGANIZATION_NAME END     AS 'Agent'

   GROUP BY

    OENT.OTHER_EXTERNAL_ID                                                                                              
    ,CASE WHEN SE.Organization_Name IS NULL OR RTRIM(LTRIM(SE.ORGANIZATION_NAME)) = '' THEN '' ELSE SE.ORGANIZATION_NAME END
</code></pre>

<p>Where do i use the distinct properly so it lists the case as one row no matter what case it satisfies?</p>

<p>Thanks</p>

<p>Problem is that it keep returning </p>

<pre><code>AGENT_NUMBER    AGENT

MA12348677  DREHWING, DOUGLAS

MA12348677  DREHWING, DOUGLAS A
</code></pre>

<p>Where i want this to be one row as they have the same AGENT_NUMBER</p>