Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820

    Question Unanswered: can ne1 tell me whats wrong with this Sql

    SELECT BoMTraced.Parent, BoMTraced.FirstCom, Sum(BoMTraced.Weights) AS SumOfWeights
    FROM BoMTraced
    GROUP BY BoMTraced.Parent, BoMTraced.FirstCom
    HAVING (((BoMTraced.FirstCom) Like "[23V]*"));

    all access says is "You tried to execute a query that does not include the specified expression 'BoMTraced.FirstCom) Like "[23V]*"' as part of an aggregate function" which means nothing to me
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  2. #2
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Re: can ne1 tell me whats wrong with this Sql

    why not do this:
    SELECT BoMTraced.Parent, BoMTraced.FirstCom, Sum(BoMTraced.Weights) AS SumOfWeights
    FROM BoMTraced
    where BoMTraced.FirstCom Like "[23V]*"
    GROUP BY BoMTraced.Parent, BoMTraced.FirstCom

    and Im asuming that firstCom is a text field and being so I dont think that you cant evaluate a text field in a having clause, but a where clause lets you set up conditions on non numeric fields all day long.
    Give that a go and let us know
    Jim


    Originally posted by m.timoney
    SELECT BoMTraced.Parent, BoMTraced.FirstCom, Sum(BoMTraced.Weights) AS SumOfWeights
    FROM BoMTraced
    GROUP BY BoMTraced.Parent, BoMTraced.FirstCom
    HAVING (((BoMTraced.FirstCom) Like "[23V]*"));

    all access says is "You tried to execute a query that does not include the specified expression 'BoMTraced.FirstCom) Like "[23V]*"' as part of an aggregate function" which means nothing to me

  3. #3
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    thanks figured it, that'll teach me not to use the design view and to code it from scratch, as design view don't allow grouping and a critia statement,

    this has definatly given me my answer to my signiture, now the question is should i follow my delivery instructions?
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  4. #4
    Join Date
    Oct 2002
    Posts
    48

    With Having you can use GROUP condition.

    With HAVING clause you can use GROUP field's condition.
    with WHERE you can use simple field's condition.

    e.g.

    Group BY (Sum(Salary) > 0 )

    e.g.

    Where Salary > 0

  5. #5
    Join Date
    Nov 2002
    Location
    Boston, MA
    Posts
    5

    Re: can ne1 tell me whats wrong with this Sql

    Perhaps -
    SELECT BoMTraced.Parent, BoMTraced.FirstCom, Sum(BoMTraced.Weights) AS SumOfWeights
    FROM BoMTraced
    WHERE BoMTraced.FirstCom Like "[23V]*"
    GROUP BY BoMTraced.Parent, BoMTraced.FirstCom;

    **********
    Originally posted by m.timoney
    SELECT BoMTraced.Parent, BoMTraced.FirstCom, Sum(BoMTraced.Weights) AS SumOfWeights
    FROM BoMTraced
    GROUP BY BoMTraced.Parent, BoMTraced.FirstCom
    HAVING (((BoMTraced.FirstCom) Like "[23V]*"));

    all access says is "You tried to execute a query that does not include the specified expression 'BoMTraced.FirstCom) Like "[23V]*"' as part of an aggregate function" which means nothing to me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •