The following query is in SQL:
SELECT r.reservation_no, f.flight_no, r.departure_date,
f.departure_time, f.duration
FROM flights f, reservations r
String query = "SELECT r.reservation_no, f.flight_no, r.departure_date, f.departure_time, f.duration FROM flights f, reservations r WHERE f.flight_no=r.flight_no AND r.customer_ssn="?" ";
PreparedStatement ps = connection.prepareStatement(query);
ps.setString(1, customer_ssn);
result = ps.executeQuery();
If i have understood your question correctly, then in the place of ??? you can have either the column name or the column index number.