title: How to PIVOT multiple columns using SQL Server
body: <p>I just wrote a query (for SQL Server) that is returning this output:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>VendorId</th>
  <th>Category</th>
  <th>FirstSaleDate</th>
  <th>StoreId</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>Car</td>
  <td>1/1/2021</td>
  <td>12</td>
  </tr>
  <tr>
  <td>1</td>
  <td>Clothes</td>
  <td>1/2/2021</td>
  <td>13</td>
  </tr>
  <tr>
  <td>1</td>
  <td>Toys</td>
  <td>1/3/2021</td>
  <td>14</td>
  </tr>
  <tr>
  <td>1</td>
  <td>Food</td>
  <td>1/4/2021</td>
  <td>15</td>
  </tr>
  <tr>
  <td>1</td>
  <td>Others</td>
  <td>1/5/2021</td>
  <td>15</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>But I actually need the following output</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>VendorId</th>
  <th>Car</th>
  <th>StoreId_car</th>
  <th>Clothes</th>
  <th>StoreId_clothes</th>
  <th>Toys</th>
  <th>StoreId_toys</th>
  <th>Food</th>
  <th>StoreId_food</th>
  <th>Others</th>
  <th>StoreId_others</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>1/1/2021</td>
  <td>12</td>
  <td>1/2/2021</td>
  <td>1/2/2021</td>
  <td>1/3/2021</td>
  <td>14</td>
  <td>1/4/2021</td>
  <td>15</td>
  <td>1/5/2021</td>
  <td>15</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I am new to SQL Server, but I saw that this might be possible by using two PIVOTs. I really need your help to find the right syntax.</p>
  <p><a href="https://i.stack.imgur.com/EVan4.png" rel="nofollow noreferrer">scenario and output</a></p>