Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个表table(fieldA、fieldB、fieldC)和log_table(id、fieldA、fieldB、fieldC)。是否可以使用一个(不是两个:选择和插入)查询table来复制一行?log_table
table
log_table
先感谢您!
您可以使用单个INSERT语句传递SELECT查询而不是常量值列表:
INSERT INTO log_table (SELECT fieldA, fieldB, fieldC FROM table)
我不确定你想要什么。但也许是这样的:
INSERT INTO log_table( fieldA, fieldB, fieldC) SELECT fieldA, fieldB, fieldC FROM table