【问题标题】:-3087 error in Access 2007Access 2007 中的 -3087 错误
【发布时间】:2013-11-18 21:17:59
【问题描述】:

我有以下代码:

SELECT
    Count(personnel.Position) AS countofposition,
    personnel.Position, 
    Year(DateAdd("m",-6,[Personnel.End_Date])) & "-"
        & Year(DateAdd("m",6,[Personnel.End_Date]))
FROM personnel 
GROUP BY Year(DateAdd("m",-6,[Personnel.End_Date])) & "-"
    & Year(DateAdd("m",6,[Personnel.End_Date]));

我收到“保留错误 (-3087);没有针对此错误的消息”消息

我检查了保留字列表,我很确定我没有使用任何保留字。我唯一能想到的是“Year(DateAdd .... blahblahblahblahblah)”中的“Year”让我很困惑

编辑:另外,personal.position 是一个多值字段 想法?

【问题讨论】:

    标签: sql ms-access ms-access-2007


    【解决方案1】:

    我想这就是你要找的东西:

    对于具有多值字段[职位]的表[人员]:

    ID  FirstName  LastName  Position        End_Date
    --  ---------  --------  --------------  ----------
    1   Gord       Thompson  CTO, President  2013-11-01
    2   Anne       Elk       Vice-President  2013-11-01
    3   P. T.      Gumby     Vice-President  2013-11-01
    

    查询

    SELECT 
        Count(Personnel.Position.Value) AS CountOfPosition_Value, 
        Personnel.Position.Value, 
        Year(DateAdd("m",-6,[Personnel.End_Date])) & "-" & Year(DateAdd("m",6,[Personnel.End_Date])) AS Expr1
    FROM Personnel
    GROUP BY 
        Personnel.Position.Value, 
        Year(DateAdd("m",-6,[Personnel.End_Date])) & "-" & Year(DateAdd("m",6,[Personnel.End_Date]));
    

    返回

    CountOfPosition_Value  Personnel.Position.Value  Expr1    
    ---------------------  ------------------------  ---------
                        1  CTO                       2013-2014
                        1  President                 2013-2014
                        2  Vice-President            2013-2014
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多