How to use sub query or CTE inside values method of insert?

I want to the results from CTE or sub query inside the select

const tableOneSubQuery = db.select({name: tableOne.columnOne}).from(tableOne).as('table_one_sub_query');

db.insert(tableTwo).values({columnTwo: tableOneSubQuery.name});


This seems to be a wrong way to do this (TypeScript complains). What is the right way to go about this?
Was this page helpful?