Mysql UPDATE Query error: Unknown Column in 'field list'
Mysql UPDATE Query error: Unknown Column in 'field list'
我正在尝试使用以下查询添加新列:
UPDATE t1
INNER JOIN
(SELECT
t1.CID as t1_id,
t2.id as t2_id
FROM t3
INNER JOIN t1 ON t3.CID = t1.CID
INNER JOIN t4 ON t4.MID = t3.MID
INNER JOIN t2 ON t2.serial = t4.Serial
AND t3.Time BETWEEN t2.Start_Time AND t2.End_Time) as sub
ON sub.t1_id = t1.CID
SET t1.t2_id = sub.t2_id
显示错误:Unknown column 't1.t2_ID' in 'field list'
我见过几个 fieldlist
错误解决方案,但其中 none 确实帮助了我。因此,我们将不胜感激。
如果要添加列,请使用 ALTER TABLE
ALTER TABLE table
ADD [COLUMN] column_name column_definition [FIRST|AFTER existing_column];
http://www.mysqltutorial.org/mysql-add-column/
然后你可以使用UPDATE
填写那个字段
我正在尝试使用以下查询添加新列:
UPDATE t1
INNER JOIN
(SELECT
t1.CID as t1_id,
t2.id as t2_id
FROM t3
INNER JOIN t1 ON t3.CID = t1.CID
INNER JOIN t4 ON t4.MID = t3.MID
INNER JOIN t2 ON t2.serial = t4.Serial
AND t3.Time BETWEEN t2.Start_Time AND t2.End_Time) as sub
ON sub.t1_id = t1.CID
SET t1.t2_id = sub.t2_id
显示错误:Unknown column 't1.t2_ID' in 'field list'
我见过几个 fieldlist
错误解决方案,但其中 none 确实帮助了我。因此,我们将不胜感激。
如果要添加列,请使用 ALTER TABLE
ALTER TABLE table
ADD [COLUMN] column_name column_definition [FIRST|AFTER existing_column];
http://www.mysqltutorial.org/mysql-add-column/
然后你可以使用UPDATE
填写那个字段