Objection.js Syntax for INSERT INTO ... SELECT

281 Views Asked by At

The datastore is postgres. Can someone help in translating this to an Objection.js statement? It's easy to do this with two roundtrips, but ideally this would happen in one.

INSERT INTO reports (
    id,
    created_by,
    desc,
    dataset
)
SELECT 
    '8971e660-7777-4d64-8cc3-171512063fff',
    123,
    'clone!',
    r.dataset,
FROM reports r
WHERE r.id = '7771e660-9d7d-4d64-8cc3-17151206354f';
0

There are 0 best solutions below