I am not specifying any names here but the query has to pick the names up from NAME column already in table_details .

regards