typeorm-linq-repository
typeorm-linq-repository copied to clipboard
Get MAX/MIN value
Hi,
I using lib, but cannot find syntax get MAX/MIN value (ID: number) on a Table
Thanks.
Hi @longpro1601,
I will look into an elegant way to implement this into the lib's syntax, but in the meantime, you can use:
await repository
.typeormRepository
.createQueryBuilder("entity")
.select("MAX(entity.id)", "max")
.getRawOne();