I have a query like this:
select (price1 + price2 + price3) as total_price from prices
How can i use the computed column total_price to c
I'd also consider a computed column on the table if this will used often
ALTER TABLE prices ADD total_price AS (price1 + price2 + price3)
Then your query is
select total_price, (price4 + total_price) as total_price2 from prices
This way, you can apply the DRY principle...