我想在同一张表中克隆客户1(Alex)的数据,但是客户2(TOM):
+----+----------+-------+--------+-------+
| ID | Customer | INPUT | OUTPUT | WIN |
+----+----------+-------+--------+-------+
| 1 | Alex | test1 | test2 | test3 |
| 2 | Alex | test5 | test8 | test8 |
+----+----------+-------+--------+-------+
这不起作用:
INSERT INTO my_table (Customer,INPUT,OUTPUT,WIN)
VALUES "TOM", (SELECT INPUT,OUTPUT,WIN FROM my_table)
答案 0 :(得分:1)
在SELECT
:
INSERT INTO my_table (Customer,INPUT,OUTPUT,WIN)
SELECT "TOM", INPUT,OUTPUT,WIN FROM my_table;
我还要添加WHERE
INSERT INTO my_table (Customer,INPUT,OUTPUT,WIN)
SELECT "TOM", INPUT,OUTPUT,WIN FROM my_table WHERE Customer='Alex';