David
David
DTDrizzle Team
Created by David on 12/7/2024 in #help
How to use subqueries with query
It's the main part of the project really. It can have hundreds of thousands of rows. The idea is to only show jobs that haven't been accepted by both the employee and the job seeker.
9 replies
DTDrizzle Team
Created by David on 12/7/2024 in #help
How to use subqueries with query
Wasn't aware that I had to add that leftJoin, because this was a rework of my previous select that had the join outside the subquery. though the join was on the query here but guess not. Wouldn't this be highly unperformant due to having to go through the jobs table again? Thanks nontheless
9 replies
DTDrizzle Team
Created by David on 12/7/2024 in #help
How to use subqueries with query
.
9 replies
DTDrizzle Team
Created by David on 12/5/2024 in #help
Smart way to prepare data for frontend
yea thats really not ideal, goona make another thread for that hopefully theres an answer
11 replies
DTDrizzle Team
Created by David on 12/5/2024 in #help
Smart way to prepare data for frontend
so queries wouldn't work for in my use case? that sucks
11 replies
DTDrizzle Team
Created by David on 12/5/2024 in #help
Smart way to prepare data for frontend
No description
11 replies
DTDrizzle Team
Created by David on 12/5/2024 in #help
Smart way to prepare data for frontend
@francis reckon there's a way to fix
invalid reference to FROM-clause entry for table jobs
invalid reference to FROM-clause entry for table jobs
It's caused by what's inside the where
const jobsDb = await db.query.jobs_table.findMany({
where: notExists(
db
.select()
.from(job_user_statuses_table)
.where(
and(
eq(
job_user_statuses_table.job_id,
jobs_table.id,
),
eq(job_user_statuses_table.accepted, true),
eq(job_user_statuses_table.user_id, userId),
),
),
),
orderBy: sql`RAND()`,
with: {
working_days: true,
location: true,
location_image_file: true,
required_languages: true,
required_skills: true,
},
});
const jobsDb = await db.query.jobs_table.findMany({
where: notExists(
db
.select()
.from(job_user_statuses_table)
.where(
and(
eq(
job_user_statuses_table.job_id,
jobs_table.id,
),
eq(job_user_statuses_table.accepted, true),
eq(job_user_statuses_table.user_id, userId),
),
),
),
orderBy: sql`RAND()`,
with: {
working_days: true,
location: true,
location_image_file: true,
required_languages: true,
required_skills: true,
},
});
Reckon that it can't infer where jobs_table comes from because it's nested inside another db request? If not is there a way to add a join and use the where logic onthe query?
11 replies
DTDrizzle Team
Created by David on 12/5/2024 in #help
Smart way to prepare data for frontend
Managed to completely skip that doc, only checked the select one. Yea this should do everything I want much appreciated
11 replies
DTDrizzle Team
Created by roze789 on 12/4/2024 in #help
PgEnum Error on relation
if you wanted to do that you could just do {"first_name": something}, but yea it works
10 replies
DTDrizzle Team
Created by roze789 on 12/4/2024 in #help
PgEnum Error on relation
Removes alot of headackes, cuz i sometimes change the key names and forget to change the strings
10 replies
DTDrizzle Team
Created by roze789 on 12/4/2024 in #help
PgEnum Error on relation
oh that's really interesting, didn't know that was a thing thanks!
10 replies
DTDrizzle Team
Created by roze789 on 12/4/2024 in #help
PgEnum Error on relation
is there a reason why drizzle doesnt just grab the key name instead of having you passing a string with the name?
10 replies