title: 2 listagg in one SQL Select in Oracle
body: <p>I have a table in the form of :</p>
  
  <pre><code>| ID    | COURSE | PASS |
  ---------------------------
  | 1     | 1      | 1      |
  | 1     | 2      | 1      |    
  | 1     | 3      | 1      |
  | 1     | 4      | 0      |
  | 1     | 5      | 0      |
  </code></pre>
  
  <p>and I want row in the form:</p>
  
  <pre><code>| ID    | FAILED | PASSED |
  ---------------------------
  | 1     | 4,5    | 1,2,3  |
  </code></pre>
  
  <p>the only i figured is something like this:</p>
  
  <pre><code>    select NVL(passed.id, failed.id), passed.test, failed.test from 
          (select id, listagg(course, ',') within group (order by course) test from table1 where pass = 1 group by id ) passed 
      full outer join
          (select id, listagg(course, ',') within group (order by course) test from table1 where pass = 0 group by id ) failed
      on passed.id = failed.id
  </code></pre>
  
  <p>is there a way to do it in a single query ?</p>