title: Selecting columns from a hive/sql table dynamically
body: <p>I am a newbie in hive and equally newbie in sql as well. So In case I am implementing my solution in an inappropriate manner, please enlighten me.</p>
  
  <p><img src="https://i.stack.imgur.com/gHqvT.png" alt="Table Structure"></p>
  
  <p>My application takes ID as input from user. Then I need to check the Pname values corresponding to it in Table1, and then based on pname's value, need to fetch corresponding column from Table2.</p>
  
  <p>In other words i need a query like this:
  <code>SELECT (SELECT Pname FROM Table1 WHERE ID=1) FROM Table2 WHERE ID=</code>1;</p>
  
  <p>Is such an operation possible in Hive? If not, what alternative solution I can try implementing?</p>
  
  <p>Thanks</p>