title: SQL Pivot and Distinct from new Columns
body: <p>I have a table called <code>ADMIN</code> that originally looks like this</p>
  <pre><code>KEY           VALUE
  Version1      2019_RQK@2019
  Version2      2019_RQK@2020
  Version2      2019_RQK@2021
  Version2      2019_RQK@2022
  Version2      2020_TKA@2020
  Version2      2020_TKA@2021
  Version2      2020_TKA@2022
  Version2      2020_TKA@2023
  </code></pre>
  <p>And I am try to change it to look like this</p>
  <pre><code>VERSION       YEAR1      YEAR2      YEAR3      YEAR4     
  2019_RQK      2019       2020       2021       2022
  2020_TKA      2020       2021       2022       2023
  </code></pre>
  <p>I wrote some SQL in order to get the left and right versions of the <code>[VALUE]</code> columns but I dont know how to condense it so that it only shows a <code>DISTINCT</code> as for the left side of the <code>[VALUE]</code> column. I tried to use distinct but it still brings up the same repeated entries, this is what I've written so far, I dont know if <code>PIVOT</code> function would work here I tried a few things it didn't end up correct.</p>
  <pre><code>SELECT DISTINCT LEFT([VALUE], 7) AS VERSION, RIGHT([VALUE], 4) AS YEAR
  FROM ADMIN
  WHERE [KEY] LIKE '%VERSION%'
  </code></pre>
  <p>Just gives me, not sure how to change it in the same query</p>
  <pre><code>VERSION      YEAR
  2019_RQK     2019
  2019_RQK     2020
  2019_RQK     2021
  2019_RQK     2022
  2020_TKA     2020
  2020_TKA     2021
  2020_TKA     2022
  2020_TKA     2023
  </code></pre>