const user = await this.userRepository .createQueryBuilder('user') .leftJoinAndSelect( // 注意这里用了 'leftJoinAndSelect' 而不只是 'leftJoin' 'user.tel', 'tel', 'tel.createdDate = (SELECT MAX(t.createdDate) FROM TelEntity t WHERE t.userId = user.id)' // 假设 tel 表的实体名为 'TelEntity',且 tel 表里与 user 表关联的字段名是 'userId' ) .where('user.id = :userId', { userId }) .getOne();