更新时间:2023-12-02 08:03:04
我认为唯一的问题是在第二行,删除FROM test
..您不能select 6, 50 from test
.. 6和50不是测试中的列,并且测试没有记录.像这样尝试:
I think the only thing wrong with this is on line two, remove FROM test
.. You can't select 6, 50 from test
.. 6 and 50 are not columns in test, and test has no records. Try it like this:
INSERT IGNORE INTO test (id, amount)
SELECT * from (select 6, 50) as a
WHERE NOT EXISTS (SELECT 1 FROM test
WHERE amount >= 50 AND id = 6)