So let's say we have a table called Prices
with columns Price1
and Price2
, and I want to create a View called Totals
with a column called PriceTotals
that adds Price1
and Price2
on the table, and a second column called PriceCut
that simply divides PriceTotals
on the view by 2:
create view `Totals` as
select
`Price1` + `Price2` as `PriceTotals`,
/**Put column definition here that divides PriceTotals by 2**/ as `PriceCut`
from `Prices`;
How do I go about that?
Can't you just do this?