-1

I have a column and I want to perform some arithmetic operation on the same column using the same column

Price
---------
10
11
12
12
14
14
14
14

If I want to know rows with Price=14 then I can write a simple select query with where clause

select * from table_name where Price = 14;

But the value of Price column keeps changing and if I want something like this

Latest value of Price is 10
select * from table_name where Price = Price + 4;

This should return all rows with value 14. How do we achieve this?

user3198755
  • 477
  • 2
  • 10
  • 21

1 Answers1

0

use subquery

 select * from table_name where Price = (select min(Price) + 4 from table_name)
Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63