我如何转换此sql代码,以便MS Access能够理解它?

时间:2019-03-24 21:47:35

标签: sql ms-access view

我有一个包含SQL和MS Access的作业,我一直在努力弄清楚,但不能。.我只是收到一条错误消息。.我的代码用于视图..

这是代码:

(SELECT Rum, COUNT(DISTINCT(Larare)) AS antal FROM Kurstillfalle
GROUP BY Rum)

1 个答案:

答案 0 :(得分:1)

访问不支持COUNT(DISTINCT列名),但是您可以这样做:

SELECT 
  t.Rum, 
  COUNT(t.Larare)) AS antal 
FROM (SELECT DISTINCT Rum, Larare FROM Kurstillfalle) AS t 
GROUP BY t.Rum