Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以将更新查询放入插入查询的子选择中?喜欢:
select * from db.testtable where col1 = 1 or (UPDATE ...);
根据您的数据库引擎,您可以执行类似的操作
INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE c=c+1;
以避免重复和更新。