我有一个列,我想使用相同的列在同一列上执行一些算术运算
Price
---------
10
11
12
12
14
14
14
14
如果我想知道Price = 14的行,那么我可以用where子句编写一个简单的select查询
select * from table_name where Price = 14;
但是Price栏的价值不断变化,如果我想要这样的话
Latest value of Price is 10
select * from table_name where Price = Price + 4;
这应该返回值为14的所有行。我们如何实现这一目标?
使用子查询
select * from table_name where Price = (select min(Price) + 4 from table_name)