BugFix: ERROR [ExceptionsHandler] column "users.areasServed" must appear in the GROUP BY clause or be used in an aggregate function resolved

This commit is contained in:
2024-09-04 18:15:16 +02:00
parent 7807afbad3
commit 9ecc0c2429
7 changed files with 2 additions and 97 deletions

View File

@@ -140,10 +140,4 @@ export class UserService {
throw error;
}
}
async getStates(): Promise<any[]> {
const query = sql`SELECT jsonb_array_elements(${schema.users.areasServed}) ->> 'state' AS state, COUNT(DISTINCT ${schema.users.id}) AS count FROM ${schema.users} GROUP BY state ORDER BY count DESC`;
const result = await this.conn.execute(query);
return result.rows;
}
}