SQL Access group by 使用注意事项

SQL Access group by 使用注意事项

在MS SQL 中正常的语句:

select Field1,sum(Field2) as Field2n from Tables where group by Field1 order by Field2 desc

在Access中会报错:

主要原因是受后缀:order by 的影响,它会把order by 的参数当做合计函数的一部分,应该改成:

select * from (
    select Field1,sum(Field2) as Field2n from Tables where group by Field1 
) order by Field2 desc

  

 

 

 

创建时间:2023.01.05  更新时间:

posted on 2023-01-05 09:25  滔Roy  阅读(179)  评论(0编辑  收藏  举报

导航