2

在 MS Access 中,如何引用构建器中的现有表达式?

我试着把它输入为:Expr1,我也试着把它放在这样的括号里:(Expr1),在这两种情况下,出来的数字都没有意义。

更新:

目前我有这些现有的表达式

SELECT tblInventory.ProductNo, tblInventory.NewFSPrice, tblInventory.FSPrice,     tblInventory.FSMarkUp, tblInventory.Cost, [tblInventory]![Cost]/[tblInventory]![FSMarkUp]      AS Expr1, [tblInventory]![Cost]/[tblInventory]![FSPrice] AS Expr2
FROM tblInventory;

如果真的归结为我必须将它们括起来然后运行它们,我会的,但我想知道是否有一种方法我不必再次将它们写出来,这样我就可以在一个表达式中使用它们像

FSPrice - Expr1

4

1 回答 1

2

Here is my query

SELECT tblInventory.ProductNo, 
       tblInventory.NewFSPrice, 
       tblInventory.FSPrice,  
       tblInventory.FSMarkUp,  
       tblInventory.Cost,  
       [tblInventory]![Cost]/[tblInventory]![FSMarkUp] AS Expr1,  
       [tblInventory]![Cost]/[tblInventory]![FSPrice] AS Expr2,  
       [FSPrice]-[Expr1] AS Expr3
FROM tblInventory;

Returning

ProductNo   NewFSPrice  FSPrice FSMarkUp    Cost    Expr1   Expr2   Expr3
1           10          10      5           5       1       0.5     9

Note that Expr3 must occur after Expr1 in the design grid. In addition, I am not dividing by zero at any point, nor are any nulls returned, if there were, I would need to allow for that by using IIfs and / or Nz.

于 2013-03-12T15:43:10.157 回答