title: Select records from ResultSet java
body: <p>I have a long query in Java which is put in a result set and executed by the executeQuery(string) method. Now I need to traverse this result set, query each of the records in the result set (method get_linked_OrgTickets contains this query) and output only those rows which return something in Vector linkedToTicket from the ResultSet. Can I sort of traverse this ResultSet and copy the said rows into another result set or maybe remove the rows not to be outputted from the ResultSet? Is there another way to solve this?    </p>
  
  <pre><code>if (linked == J.LINKED_TO_ORG){
      while (rs.next()){
             Vector linkedToTicket = Ticket.get_linked_OrgTickets(con, rs.getInt(Ticket.FLD_ID)); 
  
             if (linkedToTicket != null)
             {                                
            // if there are linked tickets in the result set, output them only
  
          }
      }
  }
  </code></pre>
  
  <p>*<em>EDIT: *</em> These subqueries can't be integrated with the main query. The only way to do that is to execute the main query once without this and the second time with it included which would be too inefficient. ResultSet class does not seem to contain methods for deleting a row without affecting the database or for building a ResultSet 'manually'.</p>
  
  <p>Please help!</p>