我有一个products
表,其中包含views
字段。每当我选择product
时,我都希望增加views
。有两个查询很简单:
-- Get the product
SELECT * FROM product WHERE id = 1;
-- Increment the product's views
UPDATE product SET views = views + 1 WHERE id = 1;
我可以在一个查询中执行此操作,不使用triggers
或stored procedures
?