Do you by chance look for something like this?
SELECT p
FROM App\Entity\Product p
WHERE (p.price_new > 0 AND p.price_new = :price)
OR (p.price_new = 0 AND p.price = :price)
If this is in fact what you are looking for, I would suggest creating a migration that updates your table's price
field with the new price and then you can throw out the somewhat redundant price_new
. If you need the current state you can create a database dump and retrieve both values, but in your live system you likely only want to have one price.
The migration could look something like this (real SQL this time):
UPDATE product SET product.price = product.price_new WHERE product.price_new > 0;
Then it's a matter of removing the redundant price_new
both in your code and in your database and you are good to go.