help with count()

How can I count the amount of rows where userId column has a given value?
3 Replies
ubinatus
ubinatus7mo ago
Hi! Have you tried db.select({ count: count() }).from(YOUR_TABLE).where(eq(YOUT_TABLE.userId, YOUR_GIVEN_VALUE)) ?
pato
patoOP7mo ago
ohhh, so a .where after the count no I haven't, will try soon, thanks it says An argument for 'id' was not provided. for the count function @ubinatus nevermind, it was something else I havent tested it, but it prob works
Mykhailo
Mykhailo7mo ago
Hey guys. You can check this guide https://orm.drizzle.team/learn/guides/count-rows. It might can help you
Want results from more Discord servers?
Add your server