不同表值相加 |微软访问
如何将两个表的值添加到一个表记录中,例如
项目表:
ID - 自动编号
OrderID - 数字
价格 - 货币
详细信息 - 文本
订单表:
ID - 自动编号
CustomerID - 编号
日期 - 日期
TotalPrice - 货币
TotalPrice 应将所有商品以及将它们添加到 TotalPrice 中的总价格相加,该总价格将收集为创纪录的价值。
How do I get two tables of their values to add up into one table record, e.g.
Item table:
ID - Autonumber
OrderID - Number
Price - Currency
Details - Text
Order table:
ID - Autonumber
CustomerID - Number
Date - Date
TotalPrice - Currency
The TotalPrice should add up all the items and the total price of adding them up into the TotalPrice which would be collected as a record value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想在 Access 中使用 SQL 语法对一列数据进行总计,则应将
SUM
关键字与GROUP BY
结合使用。在您的情况下,请使用如下所示的内容:
如果您希望将该列存储在订单表中,那么您仍将使用上述语法(或类似的语法)来计算它。
如何在 Access 中使用它取决于您。您可以将其存储为命名查询,并使该查询成为数据表的记录源。或者您可以将此 sql 直接加载到数据表的记录源中。或单一表格。
If you want to total up a column of data using SQL syntax in Access you should use the
SUM
keyword withGROUP BY
.In your case use this something like this:
If you wish to store that column in the Order table then you would still use the above syntax (or similar) to calculate it.
How you use this inside Access depends on you. You could store this as a named query and make the query the Record Source for a Datasheet. Or you can load this sql directly into the Record Source of a Datasheet. Or a Single Form.