首页 > 解决方案 > 查询在 From 子句错误中给了我一个语法错误

问题描述

此 SQL 查询在较旧的 MS Access 文件中完美运行,但在为较新的表重新创建它后,它在 from 子句中给我一个语法错误。

select * from ( with dso as (select month, product_line, third_cust_indic as sales_type,  
                    sum(sales) + sum(beg_snb_ra) as beg_sales,  
    

可能是什么问题呢?

标签: sqlsql-server

解决方案


如果这是 SQL Server,则该with语句需要位于select

with dso as (
      select . . .
      . . .
     )
select . . .

推荐阅读