gpt4 book ai didi

php - 如何将多个选定的行值从其他表插入到新表

转载 作者:行者123 更新时间:2023-12-01 00:18:08 27 4
gpt4 key购买 nike

from one Query is it possible to do?

将一张表中的多选行信息插入到另一张表中喜欢:

Customers (register_no,CustomerName, City, Country)
Suppliers(register_no,SupplierName, City, Country)

INSERT INTO Customers (register_no,CustomerName, City, Country)
SELECT register_no SupplierName, City, Country FROM Suppliers where register_no=10;

但是一次可以选择register_no=1,register_no=3,register_no=10;在一次查询中

最佳答案

是的,可以通过在

中使用
INSERT INTO Customers (register_no,CustomerName, City, Country)
SELECT register_no SupplierName, City, Country FROM Suppliers where register_no in (1,3,10)

关于php - 如何将多个选定的行值从其他表插入到新表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46010664/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com