vendredi 29 mai 2015

Search a table with the result of another search in servlet

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?

Aucun commentaire:

Enregistrer un commentaire