strangecyan
strangecyan
DTDrizzle Team
Created by strangecyan on 6/3/2024 in #help
Multiple subqueries with .with
Hey all - thank you in advance for the help I'm trying to port a SQL query over to drizzle and am struggling with using multiple CTE in one query. I'm not getting any type errors in my project but in the studio I'm getting "this isn't a valid drizzle query" and I'm not getting any results when I run it in place. I'm more than happy to refactor the query if it helps.
3 replies
DTDrizzle Team
Created by strangecyan on 12/5/2023 in #help
WITH + UPDATE
Hey, I’m not sure how’s best to convert this query to something usable in drizzle. I’m happy to just raw dog the sql operator but I’m not sure how to still get the great typing with it. I can’t seem to combine “With” with anything but select. Please help! WITH locked_jobs AS ( SELECT * FROM jobs WHERE state = 'available'::job_state) UPDATE job SET state = 'running'::job_state, FROM locked_jobs WHERE jobs.id = locked_jobs.id RETURNING job.*;
3 replies