我无法SELECT COUNT(*)
从我在 Korma 中映射的实体中获取信息。
这是我的实体:
(declare users responses)
(korma/defentity users
(korma/entity-fields :id :slack_id :active :token :token_created)
(korma/many-to-many responses :userresponses))
这是我的尝试SELECT COUNT(*)
:
(korma/select
schema/users
(korma/fields ["count(*)"])
(korma/where {:slack_id slack-id}))
我收到此错误:
ERROR: column "users.id" must appear in the GROUP BY clause or be used in an aggregate function at character 8
STATEMENT: SELECT "users"."id", "users"."slack_id", "users"."active", "users"."token", "users"."token_created", count(*) FROM "users" WHERE ("users"."slack_id" = $1)
即使我在此查询中指定要选择的字段,看起来 Korma 也包含了我的实体字段。我该如何覆盖它?