如何在 ID 最大的数据库 table 中插入值
How to Insert values in database table where ID is max
我想在事务 ID 为 maximum.How 的数据库 table 中插入一些值,我可以这样做吗?
INSERT INTO transaction_db (score1,score2)
VALUES ('1','1')
WHERE transaction_id=(Select MAX(transaction_id) from transaction_db)
1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near 'where transaction_id3=(Select MAX(transaction_id3) from
transaction3_db)' at line 1
您需要使用 UPDATE
命令更改特定行的值。 INSERT
用于添加新行。 INSERT
.
中的 WHERE
没有用处
UPDATE transaction_db set score1 = 1, score2 = 1 where transaction_id=(Select MAX(transaction_id) from transaction_db)
您需要使用 UPDATE
。你可以试试
UPDATE transaction_db
SET score1 = 1, score2 = 1
ORDER BY transaction_id DESC
LIMIT 1;
我想在事务 ID 为 maximum.How 的数据库 table 中插入一些值,我可以这样做吗?
INSERT INTO transaction_db (score1,score2)
VALUES ('1','1')
WHERE transaction_id=(Select MAX(transaction_id) from transaction_db)
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where transaction_id3=(Select MAX(transaction_id3) from transaction3_db)' at line 1
您需要使用 UPDATE
命令更改特定行的值。 INSERT
用于添加新行。 INSERT
.
WHERE
没有用处
UPDATE transaction_db set score1 = 1, score2 = 1 where transaction_id=(Select MAX(transaction_id) from transaction_db)
您需要使用 UPDATE
。你可以试试
UPDATE transaction_db
SET score1 = 1, score2 = 1
ORDER BY transaction_id DESC
LIMIT 1;