title: Need to concatenate multiple rows into single cell using SQL?
body: <p>Currently I have  written:</p>
  
  <pre><code>SELECT IT_ID, SUBSTR (SYS_CONNECT_BY_PATH (grp , ','), 2) GROUPS
  FROM (SELECT U.IT_ID, LAST_NAME, FIRST_NAME, GRP, ROW_NUMBER() OVER (ORDER BY U.IT_ID) rn, COUNT(*) OVER() cnt
  FROM ECG_IT_USERS U
  JOIN SECUREGROUPS G ON U.IT_ID = G.IT_ID)
  
  START WITH rn = 1
  CONNECT BY rn = PRIOR rn + 1
  </code></pre>
  
  <p>This returns:</p>
  
  <pre><code>IT_ID   GROUPS
  
  afz23   ADMIN
  afz23   ADMIN,QA
  alv77   ADMIN,QA,USER
  jaj23   ADMIN,QA,USER,USER
  klo26   ADMIN,QA,USER,USER,PROD
  klo26   ADMIN,QA,USER,USER,PROD,ADMIN
  klo26   ADMIN,QA,USER,USER,PROD,ADMIN,QA
  mav45   ADMIN,QA,USER,USER,PROD,ADMIN,QA,ADMIN
  </code></pre>
  
  <p>I can't figure out how I can make it reset after a new user is encountered? It seems to be carrying over the previous groups, even if  the user does not belong to them. </p>
  
  <p>I need to see:</p>
  
  <pre><code>IT_ID   GROUPS
  
  afz23   ADMIN,QA
  alv77   USER
  jaj23   USER
  klo26   PROD,ADMIN,QA
  mav45   ADMIN
  </code></pre>