Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

typeorm findone subquery

const result = await userRepo
                     .createQueryBuilder('user')
                     .leftJoinAndSelect(
                         qb => qb
                            .select()
                            .from(UserPhotos, 'p')
                            .orderBy({ 'p.updatedAt': 'ASC' })
                            .limit(5),
                         'photos',
                         'photos.userId = user.id' // the answer
                     )
                     .getRawMany() // .getMany() seems not working
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typeorm #findone #subquery
ADD COMMENT
Topic
Name
1+9 =