title: How to write a simple self join query to find result by comparing it self?
body: <p>Let me being honest, I am Java developer assigned with this SQL development work where I need to list out all the <strong>orderId</strong> which having <strong>nodeName</strong> 'Delay' and <strong>id</strong> is 'MAX(id)'</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;">id</th>
  <th style="text-align: center;">orderId</th>
  <th style="text-align: center;">nodeName</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">1</td>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">Rain</td>
  </tr>
  <tr>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">Summer</td>
  </tr>
  <tr>
  <td style="text-align: center;">3</td>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">Delay</td>
  </tr>
  <tr>
  <td style="text-align: center;">4</td>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">Winter</td>
  </tr>
  <tr>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">Rain</td>
  </tr>
  <tr>
  <td style="text-align: center;">6</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">Delay</td>
  </tr>
  <tr>
  <td style="text-align: center;">7</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">Summer</td>
  </tr>
  <tr>
  <td style="text-align: center;">8</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">Winter</td>
  </tr>
  <tr>
  <td style="text-align: center;">9</td>
  <td style="text-align: center;">3</td>
  <td style="text-align: center;">Rain</td>
  </tr>
  <tr>
  <td style="text-align: center;">10</td>
  <td style="text-align: center;">3</td>
  <td style="text-align: center;">Summer</td>
  </tr>
  <tr>
  <td style="text-align: center;">11</td>
  <td style="text-align: center;">3</td>
  <td style="text-align: center;">Delay</td>
  </tr>
  <tr>
  <td style="text-align: center;">12</td>
  <td style="text-align: center;">1</td>
  <td style="text-align: center;">Rain</td>
  </tr>
  <tr>
  <td style="text-align: center;">13</td>
  <td style="text-align: center;">1</td>
  <td style="text-align: center;">Delay</td>
  </tr>
  <tr>
  <td style="text-align: center;">14</td>
  <td style="text-align: center;">1</td>
  <td style="text-align: center;">Summer</td>
  </tr>
  <tr>
  <td style="text-align: center;">15</td>
  <td style="text-align: center;">1</td>
  <td style="text-align: center;">Delay</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>In above example it should fetch orderId 3 and 1 and ignore rest of the all orderId.
  I know few might think it's a silly question but I have not much experience on SQL queries so I raised it on this forum.</p>