How do you create a scalar subquery in drizzle?

I want to create the drizzle analog of select * from table_a where id = (select a_id from table_b where id = <....>)

This works in raw SQL, but I'm not sure how to construct the subquery to get only the a_id field to supply in the where condition.

drizzle.select().from(tableA).where(eq(tableA.id, drizzle.select(<WHAT GOES HERE>).from(tableB).where(eq(tableB.id, userInputBId))))
Was this page helpful?