title: Can someone help me to write the Oracle SQL query for the following data
body: <p>table1:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>NAME</th>
  <th>SAL</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>ab</td>
  <td>34</td>
  </tr>
  <tr>
  <td>ab</td>
  <td>322</td>
  </tr>
  <tr>
  <td>ab_d</td>
  <td>34</td>
  </tr>
  <tr>
  <td>ab_d</td>
  <td>322</td>
  </tr>
  <tr>
  <td>aa</td>
  <td>34</td>
  </tr>
  <tr>
  <td>aa</td>
  <td>322</td>
  </tr>
  <tr>
  <td>bb</td>
  <td>34</td>
  </tr>
  <tr>
  <td>bb</td>
  <td>322</td>
  </tr>
  <tr>
  <td>ac</td>
  <td>65</td>
  </tr>
  <tr>
  <td>ac_d</td>
  <td>876</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>table 2:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>col1</th>
  <th>col2</th>
  <th>col3</th>
  <th>col4</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>ab</td>
  <td>ab_d</td>
  <td>aa</td>
  <td>bb</td>
  </tr>
  <tr>
  <td>ac</td>
  <td>ac_d</td>
  <td>ss</td>
  <td>pp</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>this table2 also contains multiple rows</p>
  <p>case 1: If I use table1.name = ab as a where condition,
  the output should be,
  ab, ab_d, aa, bb records</p>
  <p>select * from table1 t1
  where t1.name = 'ab';</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>NAME</th>
  <th>SAL</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>ab</td>
  <td>34</td>
  </tr>
  <tr>
  <td>ab</td>
  <td>322</td>
  </tr>
  <tr>
  <td>ab_d</td>
  <td>34</td>
  </tr>
  <tr>
  <td>ab_d</td>
  <td>322</td>
  </tr>
  <tr>
  <td>aa</td>
  <td>34</td>
  </tr>
  <tr>
  <td>aa</td>
  <td>322</td>
  </tr>
  <tr>
  <td>bb</td>
  <td>34</td>
  </tr>
  <tr>
  <td>bb</td>
  <td>322</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>(or)
  case 2: If I use table2.col2 = ac_d as a where condition,
  the output should be,
  ac, ac_d, ss, pp records</p>
  <p>select * from table1 t1
  where t1.name = 'ac_d';</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>NAME</th>
  <th>SAL</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>ac</td>
  <td>34</td>
  </tr>
  <tr>
  <td>ac</td>
  <td>322</td>
  </tr>
  <tr>
  <td>ac_d</td>
  <td>34</td>
  </tr>
  <tr>
  <td>ac_d</td>
  <td>322</td>
  </tr>
  <tr>
  <td>ss</td>
  <td>34</td>
  </tr>
  <tr>
  <td>ss</td>
  <td>322</td>
  </tr>
  <tr>
  <td>pp</td>
  <td>34</td>
  </tr>
  <tr>
  <td>pp</td>
  <td>322</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I am unable to write query....</p>