Skip to content

Multiple OrderBy #205

Closed
Closed

Description

@jt-helsinki

The following:

const qb: QueryBuilder<User> = this.ormRepository
            .createQueryBuilder("user")
            .leftJoinAndSelect("user.licences", "licences", "licences.isCurrent = 1")
            .leftJoinAndSelect("licences.org", "org")
            .orderBy("user.lastName")
            .orderBy("user.firstName")
            .orderBy("org.name")
            .setParameter("organisationId", organisationId);

Only the .orderBy("org.name") works. The lastName and firstName are being ignored.

Activity

  1. pleerock commented on Jan 15, 2017

    @pleerock
    Member

    because new orderBy overrides previous. its by design... You need to use addOrderBy if you want to add new order by criteria.

  2. added a commit that references this issue on Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions