one to one query
I have a 2 models relation one to one,
visit
and visit_log
, visit_log
stores the visitId for reference to the visit table
This is the result that I want, however I want to use a where inside visitLog to filter by status
in other hands this is working but typescript is throwing error
The result I want
both are working but the first one i'm not able to filter on visitLog object.
in the second aswell are working but there are typescript errors .5 Replies
for the first issue, I believe they removed the ability for nested where statements in relational queries, but it still exists in older versions
and for the second statement, can you past the entire query?
This is working fine on the second statement only ts errors are the issue
The type you're passing to
.select()
is a table type, like an internal type for drizzle
This should get rid of the type errorThanks @angelelz!
I modify and it works now
I think you can just set the
visitLog: visitLog
and it should work.
According to the documentation: https://orm.drizzle.team/docs/joins#aggregating-resultsJoins [SQL] – DrizzleORM
Drizzle ORM | %s