DT
Drizzle Teambernardoquina

Count in relational queries

How do I count in relational queries? For example if i'm querying db.query.posts.findMany() and want to include an extra field that counts the number of likes (diff table), how can I achieve that? Couldn't make it work with the "extras" and trying to make a sqlcount() there. Thanks in advance
B
bloberenober348d ago
aggregations are not supported yet, but it's one of our priorities
W
Will253d ago
@bloberenober any news here?
AS
Andrii Sherman253d ago
still no updates here, currently you should use separate query to count anything you need Or use drizzle core api to make, where you can simulate almost any query complexity
R
Ryley18d ago
Any updates @Andrew Sherman ?
G
GetPsyched18d ago
Would prefer this done as well
F
freddie18d ago
and learn some sql along the way! drizzle core API > query builder 🤣
Want results from more Discord servers?
Add your server
More Posts
Create a type of VARCHAR[]I want to create a type for my column of `VARCHAR[]` but when I used Drizzle-Kit to generate it, I gSelect with relationIs there a way to get relations when using `db.select().from(table)`I can't get the `db.query.table.Any plan to support ClickHouse db?Any plan to support ClickHouse db? https://clickhouse.com/`where` inside relational queries `with` does not workHi there! I'm new to drizzle and tried out the relational queries. I want to do a nested `where` rIssue with 'insert on conflict do update where'I am using db.insert(lastHeaterMetricsTable) .values(heaterEntityWithMaxTime) Duplicate relations when using `with`I'm running into a problem where some duplicate values are being returned through a relation with `wUsing BIN_TO_UUID / UUID_TO_BINI’m trying to understand the best way to use `BIN_TO_UUID` and `UUID_TO_BIN` (MySQL). The below is drizzle-kit drop config file does not existI have a `/foo/drizzle.config.ts` file as suggested in the docs (https://orm.drizzle.team/kit-docs/Related object is not typed correctlyI have the following schema ``` export const menus = pgTable('menus', { id: uuid('id').primaryKey(Custom vector type with pgvectorI'm trying to use the `pgvector` extension with a custom type but am running into an issue with the Missing 'with' clause additional operators (where, limit, offset, etc)Have been digging into the docs and the latest update. ❣️ In the docs (https://orm.drizzle.team/ddrizzle-zod type errors with latest versionsI updated all drizzle deps to latest and having type errors when using drizzle-zodI am confused on how the new relational queries worksIn the docs I see the following ``` import { pgTable, serial, text, integer, boolean } from 'drizzleis not assignable to type 'DrizzleD1Database'Hello This last release was amazing. Making joins simple was the missing piece for me. However, I