I have a table **TABLE1** with 2 fields **id** and **shift** and another table **TABLE2** with 3 fields **id**, **name**, **surname**. The field id is the same an the primary key in both tables.   
In my servlet I want to select all the id's which have shift != noon. so I write

```
ResultSet rs = stmt.executeQuery("SELECT id FROM TABLE1 WHERE shifts!=NOON");

```

So i have gather all the records in **rs**. Now, How can I search through the second table in order to select the records with the id's i found in the 1st look?