title: SQL - A table with two same column names
body: <p>I have a table with user_id and entitlement where entitlement can be full game or demo, so a given user_id could have up to two rows if the user played both the full game and demo.</p>
  
  <p>I did a join to get a table with two columns that gives me info on whether or not a user who has played the full game has played the demo. The first column gives me all the IDs of players who has played the full game, while the second column will repeat the ID if the player has played the demo, or NULL if he/she hasn't.</p>
  
  <pre><code>select * from 
  (
   (select e.user_id 
      from table1 e 
      where entitlement = 'fullgame') fg
   left join
   (select e.user_id 
      from table1 e 
      where entitlement = 'demo') demo
   on fg.user_id = demo.user_id 
  )
  </code></pre>
  
  <p>My problem is now when I'm trying to join this table to tables with other information (age, country), Teradata SQL Assistant gives me an error saying there are two columns of the same name, i.e. user_id</p>
  
  <p>How can I write my query to distinguish between the two columns. Do I have to somehow rename one of the columns first?</p>