title: SQL Server 2008 query to get mixed data from two tables
body: <p>Someone please tell me the SQL query to get the result....</p>
  
  <p>Thanks!</p>
  
  <p><img src="https://i.stack.imgur.com/TeOtI.jpg" alt="enter image description here"></p>
  
  <p>From the above two tables, I want to get the <code>Photo</code>, <code>Name</code>, <code>Id of max(id)</code> from <code>Table-A</code> for each <code>category_id</code> for which the <code>parent_id</code> in <code>Table-B</code> is <code>1</code> i.e.</p>
  
  <pre><code>1005 E Byte Apple 3
  1002 B Byte Banana 5
  1007 G Byte Orange 6
  1011 K Byte Mango 7
  </code></pre>