// list of identifiers $ids = sql_get_select('id_table', 'tableA'); // selection based on that prior selection $results = sql_select('titre', 'tableB', sql_in('id_table', $ids)));