title: How to separate rows into columns in SQL based on certain condition?
body: <p>I have data like this:</p>
  
  <pre><code>Year    Q1      Q2      Q3      Q4
  ------------------------------------
  2000    421     123     145     126
  2000    422     124     146     127
  2000    423     125     147     128
  2000    424     126     148     129
  2001    425     127     149     130
  2001    426     128     150     131
  2001    427     129     151     132
  2002    428     130     152     133
  2002    429     131     153     134
  </code></pre>
  
  <p>How do I get it like this:</p>
  
  <pre><code>Year    Q1      Q2      Q3      Q4      Year    Q1      Q2      Q3      Q4      Year    Q1  Q2  Q3  Q4
  --------------------------------------------------------------------------------------------------------
  2000    421     123     145     126     2001    425     127     149     130     2002    428 130 152 133
  2000    422     124     146     127     2001    426     128     150     131     2002    429 131 153 134
  2000    423     125     147     128     2001    427     129     151     132                 
  2000    424     126     148     129                                     
  </code></pre>
  
  <p>I visited this:<a href="https://www.databasejournal.com/features/mssql/converting-rows-to-columns-pivot-and-columns-to-rows-unpivot-in-sql-server.html" rel="nofollow noreferrer">https://www.databasejournal.com/features/mssql/converting-rows-to-columns-pivot-and-columns-to-rows-unpivot-in-sql-server.html</a>
  but no success.
  May I can do that with <code>PIVOT</code> But I am not been able to do that. Please suggest me. Thanks in Advance.</p>