0

因此,假设我们有一个名为Prices和 列Price1的表Price2,并且我想创建一个名为的视图,其中一个名为Totals的列在表上PriceTotals添加Price1Price2,第二个名为的列PriceCut简单地将PriceTotals视图除以 2:

create view `Totals` as
   select
     `Price1` + `Price2` as `PriceTotals`,
     /**Put column definition here that divides PriceTotals by 2**/ as `PriceCut`       
   from `Prices`;

我该怎么做?

4

1 回答 1

0

你不能这样做吗?

CREATE VIEW Totals AS
    SELECT Price1 + Price2 AS PriceTotals,
           (Price1 + Price2)/2 AS PriceCut
        FROM Prices;
于 2012-01-16T20:03:58.180 回答