Select value from different tables based on the column value in SQL Server
<p>I have a main table A with the following fields:</p>

<p><a href="https://i.stack.imgur.com/wNFW2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wNFW2.png" alt="enter image description here"></a></p>

<p>Then I have three separate tables, each for Buildings, Classrooms and Offices. All these tables have two columns; ID and Name.</p>

<p>I want to query the table A to get the following result:</p>

<p><a href="https://i.stack.imgur.com/7nK1A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7nK1A.png" alt="enter image description here"></a></p>

<p>How can I do this?</p>