Jet SQL-语法查询 [英] Jet SQL - Syntax Query

查看:319
本文介绍了Jet SQL-语法查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

由于Jet SQL中缺少count(distinct)函数,我很挣扎.到目前为止,我的代码如下:

Hi all,

I''m struggling due to the lack of a count(distinct) function in Jet SQL. My code so far is as follows:

select
    [FailureModels].[Id],
    [FailureModels].[Description],
    [FailureModels].[FailureRate],
    [FailureModels].[FailureRateDistribution],
   [FailureModels].[ModelType],
    iif([FailureModels].[ModelType] = 'Rate&', [FailureModels].[RepairRate], [FailureModels].[MTTR]) as RepairRateMTTR,
   [GateGroupImportance].[FVImp],
   [GateGroupImportance].[BBImp],
   [GateGroupImportance].[Project],
   count(*) where [FailureModels].[Id] = [PrimaryEvents].[FailureModels]
   from ([FailureModels] INNER JOIN [GateGroupImportance]
   ON [GateGroupImportance].[EventGroup] = [FailureModels].[Id])
   INNER JOIN [PrimaryEvents] ON [PrimaryEvents].[FailureModel] = [FailureModel].[Id]


除行开头count(*)抛出语法缺失异常外,其他所有代码均会编译.有任何想法吗?

非常感谢您的任何建议,
谢谢,
斯蒂芬.
[edit]添加了代码块[/edit]


It all compiles, except the line beginning count(*) which is throwing a syntax missing exception. Has anyone any ideas?

Very grateful for any advice,
Thanks,
Stephen.
[edit]code block added[/edit]

推荐答案

感谢所有评论,它们非常宝贵.解决方案是按声明分组.我必须按提及的所有列进行分组才能解决该问题.

再次感谢,
斯蒂芬.
Thanks for all the comments, they were invaluable. The group by statement was the solution. I had to group by all of the columns mentioned to solve the problem.

Thanks again,
Stephen.


这篇关于Jet SQL-语法查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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