Php 错误:唯一约束失败…但在使用SELECT*语句(SQLite)时失败

Php 错误:唯一约束失败…但在使用SELECT*语句(SQLite)时失败,php,sqlite,sql-insert,Php,Sqlite,Sql Insert,我有个问题。我有一个表,我想将其中的数据移动到另一个表中。当我这样做时: 插入名册从名册中选择*u测试 所有行都进入数据库。问题是输入的新数据的列顺序不正确(新数据具有id其中name应为等),因此使数据不正确且无用 我试图更具体地说明insert语句,但这就是发生错误:唯一约束失败的地方。我在名册表上有一个双键,它是id和季节。我正试图将20142015名册从rosters\u test表插入到20152016和20162017名册所在的rosters表中 花名册测试表中的每一行都是20142

我有个问题。我有一个表,我想将其中的数据移动到另一个表中。当我这样做时:
插入名册从名册中选择*u测试

所有行都进入数据库。问题是输入的新数据的列顺序不正确(新数据具有
id
其中
name
应为等),因此使数据不正确且无用
我试图更具体地说明insert语句,但这就是发生
错误:唯一约束失败的地方。我在
名册
表上有一个双键,它是
id
季节
。我正试图将20142015名册从
rosters\u test
表插入到20152016和20162017名册所在的
rosters
表中

花名册测试
表中的每一行都是
20142015
赛季
,我检查了所有27行的重复ID,没有重复ID。以下是我尝试过的查询:

INSERT INTO 'rosters'
SELECT 'number' AS 'number',  'name' AS 'name' , 'height' AS 'height', 'weight' AS 'weight', 'birthplace' AS 'birthplace', 'birthdate' AS 'birthdate', 'position' AS 'position', 'id' AS 'id', 'age' AS 'age', 'season' AS 'season', 'imageURL' AS 'imageURL'
FROM 'rosters_test' 

INSERT INTO 'rosters'  (number, name, height, weight, birthplace, birthdate ,position ,id ,age ,season, imageURL) 
SELECT 'number',  'name' , 'height', 'weight', 'birthplace', 'birthdate', 'position', 'id', 'age' , 'season', 'imageURL'
FROM 'rosters_test'
我还尝试了诸如rosters\u test.number以及rosters.number之类的方法。什么都不起作用:这是两个表的模式:

CREATE TABLE 'rosters_test' ('number' INTEGER, 'name' TEXT, 'height' INTEGER, 'weight' INTEGER, 'birthplace' TEXT, 'birthdate' TEXT, 'position' TEXT, 'id' INTEGER, 'age' INTEGER, 'season' INTEGER, 'imageURL' TEXT)
我在
rosters\u测试
表上也有一个双键

CREATE TABLE 'rosters' ('position' TEXT, 'id' INTEGER, 'weight' INTEGER, 'height' TEXT, 'imageURL' TEXT, 'birthplace' TEXT, 'age' INTEGER, 'name' TEXT, 'birthdate' TEXT, 'number' INTEGER, 'season' INTEGER, PRIMARY KEY('id','season'))

使用
INSERT INTO…选择
并明确指定
rosters
表所需的列(及其顺序):

INSERT INTO rosters (position, id, weight, height, imageURL, birthplace, age, name,
                     birthdate, number, season)
SELECT position, id, weight, height, imageURL, birthplace, age, name, birthdate,
       number, season
FROM rosters_test

处理你的答案。你有
rosters\u test
作为列名。我输入了正确的列名,以便……
插入名册(位置、id、体重、身高、imageURL、出生地、年龄、姓名、出生日期、数字、季节)值选择位置、id、体重、身高、imageURL、出生地、年龄、姓名、出生日期、数字、,来自名册(测试)的季节
,但仍然在select附近出现语法错误
我将id列名更改为
id
,而不是
名册(测试)
。我不知道你为什么会在那里。重新加载页面时,我删除了不应该在那里的
值。“我将id列名改为id而不是rosters\u test。我不知道你为什么会在那里”我曾经将其作为rosters\u test.id。