# Best way to run insert ... select in a single database roundtrip?

**URL:** <https://discourse.diesel.rs/t/best-way-to-run-insert-select-in-a-single-database-roundtrip/100>\
**Category:** Uncategorized\
**Created:** [July 3, 2019, 3:06am UTC](https://discourse.diesel.rs/t/best-way-to-run-insert-select-in-a-single-database-roundtrip/100 "2019-07-03T03:06:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrbigelow](https://avatars.discourse-cdn.com/v4/letter/h/eb9ed0/32.png) [@hrbigelow](https://discourse.diesel.rs/u/hrbigelow)\
**Post date:** [July 3, 2019, 3:06am UTC](https://discourse.diesel.rs/t/best-way-to-run-insert-select-in-a-single-database-roundtrip/100/1 "2019-07-03T03:06:52Z")

</div>

Hi all, what is the best way to run a query of the (general) form:

```auto
insert (a, b, c) into target
select (d, e, f) from source
where g = :g;

```

with a single database roundtrip?

I can do this with sql\_query, but at the sacrifice of compile-time checking of proper names for tables and columns. i have not found a way to do it with `QueryDsl`, but perhaps there is a way?

Thank you in advance.
