【发布时间】:2017-03-25 11:11:24
【问题描述】:
此代码在 Microsoft Access 中不起作用,但在 Microsoft SQL Server Management Studio 中起作用。我该怎么做才能在 Access 中完成这项工作?我一直收到一个
“查询表达式'CAST(od.UnitPrice * od.Quantity * (1 + od.Discount) as decimal(10,2))'Order Total'中的语法错误(缺少运算符)。
Select TOP 5
c.CompanyName as 'Company Name',
CAST(od.UnitPrice * od.Quantity * (1 + od.Discount) as decimal(10, 2)) 'Order Total'
From
Customers as c
Join
Orders as o On c.CustomerID = o.CustomerID
Join
OrderDetails as od On o.OrderID = od.OrderID
Where
od.UnitPrice * od.Quantity * (1 + od.Discount) > 5000
AND c.Country IN ('Austria', 'Denmark', 'Germany', 'Ireland', 'Sweden')
Order By
o.OrderDate desc
【问题讨论】:
-
到底是什么错误?
-
@gurV
cast出错。我不知道为什么。
标签: sql-server ms-access