gpt4 book ai didi

php - 立即将数据插入表,从 mySQL select 命令检索

转载 作者:行者123 更新时间:2023-11-29 03:31:14 25 4
gpt4 key购买 nike

我已经提到了我的原始交易表和临时交易表我想将数据插入我选择交易表值的临时交易表

    CREATE TABLE Transaction(
Tid int auto_increment primary key,
T_type varchar(20),
Amount decimal(10,2),
Tdate DATETIME,
accountNo int,
CONSTRAINT FOREIGN KEY(AccountNo) REFERENCES Account(AccountNo)
);



CREATE TABLE tempTransaction(
Tid int auto_increment primary key,
T_type varchar(20),
Amount decimal(10,2),
Tdate DATETIME,
accountNo int,
CONSTRAINT FOREIGN KEY(AccountNo) REFERENCES Account(AccountNo)
);

I want edit this query to working one That is my Question

INSERT INTO temporarytransaction VALUES (SELECT * FROM Transaction WHERE `Tdate` BETWEEN "2012-03-15" AND "2016-03-31"); 

最佳答案

不要将 values() 放入; http://dev.mysql.com/doc/refman/5.6/en/insert-select.html .

INSERT INTO temporarytransaction SELECT * FROM Transaction WHERE `Tdate` BETWEEN "2012-03-15" AND "2016-03-31";

关于php - 立即将数据插入表,从 mySQL select 命令检索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30290438/

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