Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFNULL support for association aggregates #503

Merged
merged 4 commits into from
Mar 15, 2019
Merged

Conversation

groue
Copy link
Owner

@groue groue commented Mar 14, 2019

The ?? operator makes it possible to use the IFNULL sql function with association aggregates:

// SELECT "team".*, IFNULL(MIN("player"."score"), 0) AS "minPlayerScore"
// FROM "team"
// LEFT JOIN "player" ON ("player"."teamId" = "team"."id")
// GROUP BY "team"."id"
let request = Team.annotated(with: Team.players.min(Column("score")) ?? 0)

@groue groue added this to the GRDB 4.0.0 milestone Mar 14, 2019
@groue groue mentioned this pull request Mar 14, 2019
26 tasks
@groue groue merged commit f42a184 into GRDB-4.0 Mar 15, 2019
@groue groue deleted the feature/aggregate-ifnull branch March 15, 2019 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant