title: MySQL change view column from BIGINT to BIT
body: <p>I have a table like this.</p>
  
  <pre><code>(BIGINT)     (BIGINT)
  PLAYER_ID    FRIEND_ID
  ----------------------
  1            2
  2            1
  1            3
  </code></pre>
  
  <p>I think I can make a View as</p>
  
  <pre><code>SELECT * FROM FRIEND F1 LEFT OUTER JOIN FRIEND F2 ON F1.FRIEND_ID = F2.PLAYER_ID
  </code></pre>
  
  <p>printing</p>
  
  <pre><code>F1.PLAYER_ID    F1.FRIEND_ID    F2.PLAYER_ID    F2.FRIEND_ID
  [BIGINT]        [BIGINT]        [BIGINT]        [BIGINT]
  ------------------------------------------------------------
  1               2               2               1
  2               1               1               2
  1               3               NULL            NULL
  </code></pre>
  
  <p>Can I make a View which represents those F2's existence AS BIT?</p>
  
  <pre><code>F1.PLAYER_ID    F1.FRIEND_ID    BACK
  [BIGINT]        [BIGINT]        [BIT]
  -------------------------------------
  1               2               1     // exist (1 -&gt; 2)
  2               1               1     // exist (2 -&gt; 1)
  1               3               0     // no backing relation (3 -&gt; 1)
  </code></pre>
  
  <p>UPDATE ------------------------------------------------------------------</p>
  
  <p>Sorry the above query wan't perfect.</p>
  
  <p>The query, with @Romil 's answer, must be written like this.</p>
  
  <pre><code>SELECT
      F1.PLAYER_ID,
      F1.FRIEND_ID,
      CASE WHEN F2.FRIEND_ID IS NULL THEN 0 ELSE 1 END AS BACK
  FROM FRIEND F1
      LEFT OUTER JOIN FRIEND F2
          ON F1.FRIEND_ID = F2.PLAYER_ID AND F1.PLAYER_ID = F2.FRIEND_ID
  </code></pre>