子句顺序与访问权限冲突? [英] Order by Clause conflicts with distinct in access?

查看:50
本文介绍了子句顺序与访问权限冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我解决这个问题,因为我一直无法克服这个问题

Please help me with this as I have been unable to get past this problem

在尝试执行此语句时:

SELECT distinct grade
FROM tblStudents
ORDER BY Val([grade]),grade;

access告诉我ORDER BY子句Val([grade])Distinct

access tells me that ORDER BY clause Val([grade]) conflicts with Distinct

我该如何解决?

提前谢谢

推荐答案

使用DISTINCT关键字与按SELECT子句中的所有列进行分组具有相同的效果:

Using the DISTINCT keyword has the same effect as grouping by all columns in the SELECT clause:

SELECT grade
  FROM tblStudents
 GROUP 
    BY grade
 ORDER 
    BY VAL(grade), grade;

请注意,我必须删除grade IS NULL处的行,否则会出现错误条件表达式中的数据类型不匹配".

Note I had to remove rows where grade IS NULL, otherwise I got an error, "Data type mismatch in criteria expression."

这篇关于子句顺序与访问权限冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆