Siumauricio
Siumauricio
DTDrizzle Team
Created by Siumauricio on 9/5/2023 in #help
one to one query
Thanks @angelelz! I modify and it works now
const result = await this.db
.select({
...getTableColumns(visit),
visitLog: getTableColumns(visitLog),
})
.from(visit)
.innerJoin(visitLog, eq(visit.visitId, visitLog.visitId))
.where(and(eq(visitLog.status, "pending"), eq(visit.userId, userId)));
const result = await this.db
.select({
...getTableColumns(visit),
visitLog: getTableColumns(visitLog),
})
.from(visit)
.innerJoin(visitLog, eq(visit.visitId, visitLog.visitId))
.where(and(eq(visitLog.status, "pending"), eq(visit.userId, userId)));
9 replies
DTDrizzle Team
Created by Siumauricio on 9/5/2023 in #help
one to one query
This is working fine on the second statement only ts errors are the issue
SELECT "visit"."visitId",
"visit"."userId",
"visit_log"."visitLogId",
"visit_log"."status",
"visit_log"."visitId"
FROM "visit"
INNER JOIN "visit_log" ON "visit"."visitId" = "visit_log"."visitId"
WHERE ("visit_log"."status" = $1
AND "visit"."userId" = $2) -- params: ["pending", "0440c3a3-81e9-43c8-a9a3-8bfd91ed5826"]
SELECT "visit"."visitId",
"visit"."userId",
"visit_log"."visitLogId",
"visit_log"."status",
"visit_log"."visitId"
FROM "visit"
INNER JOIN "visit_log" ON "visit"."visitId" = "visit_log"."visitId"
WHERE ("visit_log"."status" = $1
AND "visit"."userId" = $2) -- params: ["pending", "0440c3a3-81e9-43c8-a9a3-8bfd91ed5826"]
9 replies