Skip to content
Advertisement

Orderby on multiple columns using typeorm

In my application, I am using MySQL and typeorm and want to do orderBy using multiple columns. I searched so many places for it but did not get any solution.

Example: I have two columns in a table user and respective User Entity

________________________________________
| id | name | createDate | createdTime |
----------------------------------------
| 1  | Sai  | 2020-12-12 | 12:20:30    |
........................................
| 2  | Ravi | 2020-12-13 | 13:20:30    |
........................................

Here, I want to orderBy createdDate and CreateTime both using typeorm something like below.

Please help me solve this.

Thank you…

Advertisement

Answer

From TypeORM:

Just replace AndOrderBy to addOrderBy:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement