`insert into A select * from A`?
See original GitHub issueIt doesnât seem possible to chain db.insertInto("A").selectFrom("A").selectAll()
.
It that possible in some other way? A workaround is to first fetch the rows from A and then insert them, however that incurs an extra roundtrip to the database.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
SQL INSERT INTO SELECT Statement - W3Schools
The INSERT INTO SELECT statement copies data from one table and inserts it into another table. The INSERT INTO SELECT statement requires that...
Read more >SQL Server INSERT INTO SELECT By Practical Examples
In this syntax, the statement inserts rows returned by the query into the target_table . The query is any valid SELECT statement that...
Read more >INSERT INTO SELECT statement overview and examples
Suppose we want to insert Top N rows from the source table to the destination table. We can use Top clause in the...
Read more >SQL INSERT INTO SELECT Statement - Programiz
In SQL, the INSERT INTO SELECT statement is used to copy records from one table to another existing table. In this tutorial, we'll...
Read more >INSERT INTO SELECT vs SELECT INTO In SQL Server
The INSERT INTO SELECT statement requires the target table to exist in the database before data can be transferred from the source table...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is now implemented and will be released with the next version. The typings are not as strict as the maybe could be. For example the types donât complain about this:
even though the SQL is incorrect. You canât insert two values when only one (
first_name
) is listed. This is difficult to type correctly because of all the implicit type conversions done by database engines. We could ignore the types and only make sure thereâs the same amount of columns in both, but even that is a bit tricky with typescript. We can enhance this later.Really? Feel free to use knex đ
Do you really think itâs a problem that this is possible? Imagine a person that would write that. What would they think it would do? A person that writes that âqueryâ clearly has no idea what SQL is. I donât really see that being a problem even though it is possible. Theory is one thing, reality is another.